Skip to content

Commit

Permalink
Fixed ineffectual assignments
Browse files Browse the repository at this point in the history
Dropped/fixed ineffectual assignments after static code analysis.
  • Loading branch information
muesli authored and bep committed Aug 10, 2019
1 parent a93cbb0 commit c577a9e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions hugofs/nosymlink_test.go
Expand Up @@ -102,9 +102,9 @@ func TestNoSymlinkFs(t *testing.T) {
return fi, err
},
} {
fi, err := stat(symlinkedDir)
_, err := stat(symlinkedDir)
assert.Equal(ErrPermissionSymlink, err)
fi, err = stat(symlinkedFile)
fi, err := stat(symlinkedFile)
assertFileStat(symlinkedFilename, fi, err)

fi, err = stat(filepath.Join(workDir, "blog"))
Expand Down
4 changes: 1 addition & 3 deletions hugolib/config.go
Expand Up @@ -256,8 +256,7 @@ func (l configLoader) loadConfig(configName string, v *viper.Viper) (string, err
}

var filename string
fileExt := helpers.ExtNoDelimiter(configName)
if fileExt != "" {
if helpers.ExtNoDelimiter(configName) != "" {
exists, _ := helpers.Exists(baseFilename, l.Fs)
if exists {
filename = baseFilename
Expand All @@ -268,7 +267,6 @@ func (l configLoader) loadConfig(configName string, v *viper.Viper) (string, err
exists, _ := helpers.Exists(filenameToCheck, l.Fs)
if exists {
filename = filenameToCheck
fileExt = ext
break
}
}
Expand Down
13 changes: 8 additions & 5 deletions hugolib/hugo_sites_build_test.go
Expand Up @@ -1204,12 +1204,15 @@ func readFileFromFs(t testing.TB, fs afero.Fs, filename string) string {
end++
}

root := filepath.Join(parts[start:end]...)
if hadSlash {
root = helpers.FilePathSeparator + root
}
/*
root := filepath.Join(parts[start:end]...)
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)
}
return string(b)
Expand Down
2 changes: 1 addition & 1 deletion output/outputFormat_test.go
Expand Up @@ -118,7 +118,7 @@ func TestGetFormatByFilename(t *testing.T) {
f, found := formats.FromFilename("my.amp.html")
require.True(t, found)
require.Equal(t, AMPFormat, f)
f, found = formats.FromFilename("my.ics")
_, found = formats.FromFilename("my.ics")
require.True(t, found)
f, found = formats.FromFilename("my.html")
require.True(t, found)
Expand Down
3 changes: 2 additions & 1 deletion tpl/collections/collections.go
Expand Up @@ -98,8 +98,9 @@ func (ns *Namespace) Delimit(seq, delimiter interface{}, last ...interface{}) (t
dStr, err := cast.ToStringE(l)
if err != nil {
dLast = nil
} else {
dLast = &dStr
}
dLast = &dStr
}

seqv := reflect.ValueOf(seq)
Expand Down

0 comments on commit c577a9e

Please sign in to comment.