Run gofmt -s

This commit is contained in:
Bjørn Erik Pedersen 2018-10-23 23:18:24 +02:00
parent e3ed4a83b8
commit 889aca054a
6 changed files with 22 additions and 24 deletions

View file

@ -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. // Only add params and new menu entries, we do not add language definitions.
if v1.IsSet(languagesKey) && v2.IsSet(languagesKey) { if v1.IsSet(languagesKey) && v2.IsSet(languagesKey) {
v1Langs := v1.GetStringMap(languagesKey) v1Langs := v1.GetStringMap(languagesKey)
for k, _ := range v1Langs { for k := range v1Langs {
langParamsKey := languagesKey + "." + k + "." + paramsKey langParamsKey := languagesKey + "." + k + "." + paramsKey
mergeStringMapKeepLeft(paramsKey, langParamsKey, v1, v2) mergeStringMapKeepLeft(paramsKey, langParamsKey, v1, v2)
} }
v2Langs := v2.GetStringMap(languagesKey) v2Langs := v2.GetStringMap(languagesKey)
for k, _ := range v2Langs { for k := range v2Langs {
if k == "" { if k == "" {
continue continue
} }

View file

@ -71,10 +71,10 @@ type FrontMatterDescriptor struct {
var ( var (
dateFieldAliases = map[string][]string{ dateFieldAliases = map[string][]string{
fmDate: []string{}, fmDate: {},
fmLastmod: []string{"modified"}, fmLastmod: {"modified"},
fmPubDate: []string{"pubdate", "published"}, fmPubDate: {"pubdate", "published"},
fmExpiryDate: []string{"unpublishdate"}, fmExpiryDate: {"unpublishdate"},
} }
) )

View file

@ -28,16 +28,16 @@ func createDefaultOutputFormats(allFormats output.Formats, cfg config.Provider)
sitemapOut, _ := allFormats.GetByName(output.SitemapFormat.Name) sitemapOut, _ := allFormats.GetByName(output.SitemapFormat.Name)
return map[string]output.Formats{ return map[string]output.Formats{
KindPage: output.Formats{htmlOut}, KindPage: {htmlOut},
KindHome: output.Formats{htmlOut, rssOut}, KindHome: {htmlOut, rssOut},
KindSection: output.Formats{htmlOut, rssOut}, KindSection: {htmlOut, rssOut},
KindTaxonomy: output.Formats{htmlOut, rssOut}, KindTaxonomy: {htmlOut, rssOut},
KindTaxonomyTerm: output.Formats{htmlOut, rssOut}, KindTaxonomyTerm: {htmlOut, rssOut},
// Below are for conistency. They are currently not used during rendering. // Below are for conistency. They are currently not used during rendering.
kindRSS: output.Formats{rssOut}, kindRSS: {rssOut},
kindSitemap: output.Formats{sitemapOut}, kindSitemap: {sitemapOut},
kindRobotsTXT: output.Formats{robotsOut}, kindRobotsTXT: {robotsOut},
kind404: output.Formats{htmlOut}, kind404: {htmlOut},
} }
} }

View file

@ -31,8 +31,6 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
const ()
type sitesBuilder struct { type sitesBuilder struct {
Cfg config.Provider Cfg config.Provider
Fs *hugofs.Fs Fs *hugofs.Fs

View file

@ -100,16 +100,16 @@ func TestGroup(t *testing.T) {
items interface{} items interface{}
expect interface{} expect interface{}
}{ }{
{"a", []*tstGrouper{&tstGrouper{}, &tstGrouper{}}, "a(2)"}, {"a", []*tstGrouper{{}, {}}, "a(2)"},
{"b", tstGroupers{&tstGrouper{}, &tstGrouper{}}, "b(2)"}, {"b", tstGroupers{&tstGrouper{}, &tstGrouper{}}, "b(2)"},
{"a", []tstGrouper{tstGrouper{}, tstGrouper{}}, "a(2)"}, {"a", []tstGrouper{{}, {}}, "a(2)"},
{"a", []*tstGrouper2{&tstGrouper2{}, &tstGrouper2{}}, "a(2)"}, {"a", []*tstGrouper2{{}, {}}, "a(2)"},
{"b", []tstGrouper2{tstGrouper2{}, tstGrouper2{}}, "b(2)"}, {"b", []tstGrouper2{{}, {}}, "b(2)"},
{"a", []*tstGrouper{}, "a(0)"}, {"a", []*tstGrouper{}, "a(0)"},
{"a", []string{"a", "b"}, false}, {"a", []string{"a", "b"}, false},
{"a", "asdf", false}, {"a", "asdf", false},
{"a", nil, false}, {"a", nil, false},
{nil, []*tstGrouper{&tstGrouper{}, &tstGrouper{}}, false}, {nil, []*tstGrouper{{}, {}}, false},
} { } {
errMsg := fmt.Sprintf("[%d] %v", i, test) errMsg := fmt.Sprintf("[%d] %v", i, test)
@ -654,7 +654,7 @@ func TestSlice(t *testing.T) {
{[]interface{}{}, []interface{}{}}, {[]interface{}{}, []interface{}{}},
{[]interface{}{nil}, []interface{}{nil}}, {[]interface{}{nil}, []interface{}{nil}},
{[]interface{}{5, "b"}, []interface{}{5, "b"}}, {[]interface{}{5, "b"}, []interface{}{5, "b"}},
{[]interface{}{tstNoStringer{}}, []tstNoStringer{tstNoStringer{}}}, {[]interface{}{tstNoStringer{}}, []tstNoStringer{{}}},
} { } {
errMsg := fmt.Sprintf("[%d] %v", i, test.args) errMsg := fmt.Sprintf("[%d] %v", i, test.args)

View file

@ -749,7 +749,7 @@ func (t *templateHandler) addTemplateFile(name, baseTemplatePath, path string) e
} }
var embeddedTemplatesAliases = map[string][]string{ var embeddedTemplatesAliases = map[string][]string{
"shortcodes/twitter.html": []string{"shortcodes/tweet.html"}, "shortcodes/twitter.html": {"shortcodes/tweet.html"},
} }
func (t *templateHandler) loadEmbedded() error { func (t *templateHandler) loadEmbedded() error {