diff --git a/hugofs/nosymlink_test.go b/hugofs/nosymlink_test.go index 5e1964419..a04e671fc 100644 --- a/hugofs/nosymlink_test.go +++ b/hugofs/nosymlink_test.go @@ -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")) diff --git a/hugolib/config.go b/hugolib/config.go index 8c2e44c10..38cf6c3c1 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -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 @@ -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 } } diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index 123c27b9c..15e4920f0 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -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) diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go index 3d2fa5d17..aef1403a9 100644 --- a/output/outputFormat_test.go +++ b/output/outputFormat_test.go @@ -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) diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go index 3839ad472..195199876 100644 --- a/tpl/collections/collections.go +++ b/tpl/collections/collections.go @@ -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)