mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fixed ineffectual assignments
Dropped/fixed ineffectual assignments after static code analysis.
This commit is contained in:
parent
a93cbb0d6c
commit
c577a9ed23
5 changed files with 14 additions and 12 deletions
|
@ -102,9 +102,9 @@ func TestNoSymlinkFs(t *testing.T) {
|
||||||
return fi, err
|
return fi, err
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
fi, err := stat(symlinkedDir)
|
_, err := stat(symlinkedDir)
|
||||||
assert.Equal(ErrPermissionSymlink, err)
|
assert.Equal(ErrPermissionSymlink, err)
|
||||||
fi, err = stat(symlinkedFile)
|
fi, err := stat(symlinkedFile)
|
||||||
assertFileStat(symlinkedFilename, fi, err)
|
assertFileStat(symlinkedFilename, fi, err)
|
||||||
|
|
||||||
fi, err = stat(filepath.Join(workDir, "blog"))
|
fi, err = stat(filepath.Join(workDir, "blog"))
|
||||||
|
|
|
@ -256,8 +256,7 @@ func (l configLoader) loadConfig(configName string, v *viper.Viper) (string, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename string
|
var filename string
|
||||||
fileExt := helpers.ExtNoDelimiter(configName)
|
if helpers.ExtNoDelimiter(configName) != "" {
|
||||||
if fileExt != "" {
|
|
||||||
exists, _ := helpers.Exists(baseFilename, l.Fs)
|
exists, _ := helpers.Exists(baseFilename, l.Fs)
|
||||||
if exists {
|
if exists {
|
||||||
filename = baseFilename
|
filename = baseFilename
|
||||||
|
@ -268,7 +267,6 @@ func (l configLoader) loadConfig(configName string, v *viper.Viper) (string, err
|
||||||
exists, _ := helpers.Exists(filenameToCheck, l.Fs)
|
exists, _ := helpers.Exists(filenameToCheck, l.Fs)
|
||||||
if exists {
|
if exists {
|
||||||
filename = filenameToCheck
|
filename = filenameToCheck
|
||||||
fileExt = ext
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1204,12 +1204,15 @@ func readFileFromFs(t testing.TB, fs afero.Fs, filename string) string {
|
||||||
end++
|
end++
|
||||||
}
|
}
|
||||||
|
|
||||||
root := filepath.Join(parts[start:end]...)
|
/*
|
||||||
if hadSlash {
|
root := filepath.Join(parts[start:end]...)
|
||||||
root = helpers.FilePathSeparator + root
|
if hadSlash {
|
||||||
}
|
root = helpers.FilePathSeparator + root
|
||||||
|
}
|
||||||
|
|
||||||
|
helpers.PrintFs(fs, root, os.Stdout)
|
||||||
|
*/
|
||||||
|
|
||||||
//helpers.PrintFs(fs, root, os.Stdout)
|
|
||||||
t.Fatalf("Failed to read file: %s", err)
|
t.Fatalf("Failed to read file: %s", err)
|
||||||
}
|
}
|
||||||
return string(b)
|
return string(b)
|
||||||
|
|
|
@ -118,7 +118,7 @@ func TestGetFormatByFilename(t *testing.T) {
|
||||||
f, found := formats.FromFilename("my.amp.html")
|
f, found := formats.FromFilename("my.amp.html")
|
||||||
require.True(t, found)
|
require.True(t, found)
|
||||||
require.Equal(t, AMPFormat, f)
|
require.Equal(t, AMPFormat, f)
|
||||||
f, found = formats.FromFilename("my.ics")
|
_, found = formats.FromFilename("my.ics")
|
||||||
require.True(t, found)
|
require.True(t, found)
|
||||||
f, found = formats.FromFilename("my.html")
|
f, found = formats.FromFilename("my.html")
|
||||||
require.True(t, found)
|
require.True(t, found)
|
||||||
|
|
|
@ -98,8 +98,9 @@ func (ns *Namespace) Delimit(seq, delimiter interface{}, last ...interface{}) (t
|
||||||
dStr, err := cast.ToStringE(l)
|
dStr, err := cast.ToStringE(l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dLast = nil
|
dLast = nil
|
||||||
|
} else {
|
||||||
|
dLast = &dStr
|
||||||
}
|
}
|
||||||
dLast = &dStr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seqv := reflect.ValueOf(seq)
|
seqv := reflect.ValueOf(seq)
|
||||||
|
|
Loading…
Reference in a new issue