diff --git a/hugolib/config.go b/hugolib/config.go index 32fa2dfca71..ec7deb2de20 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -346,12 +346,12 @@ func applyThemeConfig(v1 *viper.Viper, theme paths.ThemeConfig) error { // Only add params and new menu entries, we do not add language definitions. if v1.IsSet(languagesKey) && v2.IsSet(languagesKey) { v1Langs := v1.GetStringMap(languagesKey) - for k, _ := range v1Langs { + for k := range v1Langs { langParamsKey := languagesKey + "." + k + "." + paramsKey mergeStringMapKeepLeft(paramsKey, langParamsKey, v1, v2) } v2Langs := v2.GetStringMap(languagesKey) - for k, _ := range v2Langs { + for k := range v2Langs { if k == "" { continue } diff --git a/hugolib/pagemeta/page_frontmatter.go b/hugolib/pagemeta/page_frontmatter.go index f75613e8022..b67ffbc05a0 100644 --- a/hugolib/pagemeta/page_frontmatter.go +++ b/hugolib/pagemeta/page_frontmatter.go @@ -71,10 +71,10 @@ type FrontMatterDescriptor struct { var ( dateFieldAliases = map[string][]string{ - fmDate: []string{}, - fmLastmod: []string{"modified"}, - fmPubDate: []string{"pubdate", "published"}, - fmExpiryDate: []string{"unpublishdate"}, + fmDate: {}, + fmLastmod: {"modified"}, + fmPubDate: {"pubdate", "published"}, + fmExpiryDate: {"unpublishdate"}, } ) diff --git a/hugolib/site_output.go b/hugolib/site_output.go index 0e0fe76a7ec..0a751396147 100644 --- a/hugolib/site_output.go +++ b/hugolib/site_output.go @@ -28,16 +28,16 @@ func createDefaultOutputFormats(allFormats output.Formats, cfg config.Provider) sitemapOut, _ := allFormats.GetByName(output.SitemapFormat.Name) return map[string]output.Formats{ - KindPage: output.Formats{htmlOut}, - KindHome: output.Formats{htmlOut, rssOut}, - KindSection: output.Formats{htmlOut, rssOut}, - KindTaxonomy: output.Formats{htmlOut, rssOut}, - KindTaxonomyTerm: output.Formats{htmlOut, rssOut}, + KindPage: {htmlOut}, + KindHome: {htmlOut, rssOut}, + KindSection: {htmlOut, rssOut}, + KindTaxonomy: {htmlOut, rssOut}, + KindTaxonomyTerm: {htmlOut, rssOut}, // Below are for conistency. They are currently not used during rendering. - kindRSS: output.Formats{rssOut}, - kindSitemap: output.Formats{sitemapOut}, - kindRobotsTXT: output.Formats{robotsOut}, - kind404: output.Formats{htmlOut}, + kindRSS: {rssOut}, + kindSitemap: {sitemapOut}, + kindRobotsTXT: {robotsOut}, + kind404: {htmlOut}, } } diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go index d37d83ed351..469cfeb4a8e 100644 --- a/hugolib/testhelpers_test.go +++ b/hugolib/testhelpers_test.go @@ -31,8 +31,6 @@ import ( "github.com/stretchr/testify/require" ) -const () - type sitesBuilder struct { Cfg config.Provider Fs *hugofs.Fs diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index b3ac8a8f2bd..0edb8299f3a 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -100,16 +100,16 @@ func TestGroup(t *testing.T) { items interface{} expect interface{} }{ - {"a", []*tstGrouper{&tstGrouper{}, &tstGrouper{}}, "a(2)"}, + {"a", []*tstGrouper{{}, {}}, "a(2)"}, {"b", tstGroupers{&tstGrouper{}, &tstGrouper{}}, "b(2)"}, - {"a", []tstGrouper{tstGrouper{}, tstGrouper{}}, "a(2)"}, - {"a", []*tstGrouper2{&tstGrouper2{}, &tstGrouper2{}}, "a(2)"}, - {"b", []tstGrouper2{tstGrouper2{}, tstGrouper2{}}, "b(2)"}, + {"a", []tstGrouper{{}, {}}, "a(2)"}, + {"a", []*tstGrouper2{{}, {}}, "a(2)"}, + {"b", []tstGrouper2{{}, {}}, "b(2)"}, {"a", []*tstGrouper{}, "a(0)"}, {"a", []string{"a", "b"}, false}, {"a", "asdf", false}, {"a", nil, false}, - {nil, []*tstGrouper{&tstGrouper{}, &tstGrouper{}}, false}, + {nil, []*tstGrouper{{}, {}}, false}, } { errMsg := fmt.Sprintf("[%d] %v", i, test) @@ -654,7 +654,7 @@ func TestSlice(t *testing.T) { {[]interface{}{}, []interface{}{}}, {[]interface{}{nil}, []interface{}{nil}}, {[]interface{}{5, "b"}, []interface{}{5, "b"}}, - {[]interface{}{tstNoStringer{}}, []tstNoStringer{tstNoStringer{}}}, + {[]interface{}{tstNoStringer{}}, []tstNoStringer{{}}}, } { errMsg := fmt.Sprintf("[%d] %v", i, test.args) diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index fc77bb1affa..8a26ce0e1f8 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -749,7 +749,7 @@ func (t *templateHandler) addTemplateFile(name, baseTemplatePath, path string) e } var embeddedTemplatesAliases = map[string][]string{ - "shortcodes/twitter.html": []string{"shortcodes/tweet.html"}, + "shortcodes/twitter.html": {"shortcodes/tweet.html"}, } func (t *templateHandler) loadEmbedded() error {