diff --git a/helpers/content.go b/helpers/content.go index ccbdb09c5..a70fa6075 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -426,7 +426,7 @@ func TruncateWordsByRune(words []string, max int) (string, bool) { } else if count+runeCount < max { count += runeCount } else { - for ri, _ := range word { + for ri := range word { if count >= max { truncatedWords := append(words[:index], word[:ri]) return strings.Join(truncatedWords, " "), true diff --git a/helpers/pygments_test.go b/helpers/pygments_test.go index d90e4b00e..7ee07828c 100644 --- a/helpers/pygments_test.go +++ b/helpers/pygments_test.go @@ -69,7 +69,6 @@ func TestParseDefaultPygmentsArgs(t *testing.T) { {"", nil, nil, "style=foo,noclasses=false"}, {"style=foo,noclasses=false", nil, nil, "style=override,noclasses=override"}, {"style=foo,noclasses=false", "override", false, "style=override,noclasses=override"}, - } { viper.Reset() diff --git a/hugolib/pageCache.go b/hugolib/pageCache.go index 0bd0ea398..e0a3a160b 100644 --- a/hugolib/pageCache.go +++ b/hugolib/pageCache.go @@ -66,7 +66,7 @@ func (c *pageCache) get(key string, p Pages, apply func(p Pages)) (Pages, bool) if v, ok := c.m[key]; ok { c.m[key] = append(v, [2]Pages{p, pagesCopy}) } else { - c.m[key] = [][2]Pages{[2]Pages{p, pagesCopy}} + c.m[key] = [][2]Pages{{p, pagesCopy}} } return pagesCopy, false diff --git a/hugolib/scratch.go b/hugolib/scratch.go index 6c0ce9a85..a3b73e402 100644 --- a/hugolib/scratch.go +++ b/hugolib/scratch.go @@ -74,7 +74,7 @@ func (c *Scratch) GetSortedMapValues(key string) interface{} { unsortedMap := c.values[key].(map[string]interface{}) var keys []string - for mapKey, _ := range unsortedMap { + for mapKey := range unsortedMap { keys = append(keys, mapKey) } diff --git a/tpl/template_funcs_test.go b/tpl/template_funcs_test.go index 95e84bf36..f656aa6ee 100644 --- a/tpl/template_funcs_test.go +++ b/tpl/template_funcs_test.go @@ -20,12 +20,12 @@ import ( "fmt" "github.com/spf13/cast" "html/template" + "math/rand" "path" "reflect" "runtime" "testing" "time" - "math/rand" "github.com/stretchr/testify/assert" ) @@ -345,7 +345,7 @@ func TestAfter(t *testing.T) { func TestShuffleInputAndOutputFormat(t *testing.T) { for i, this := range []struct { sequence interface{} - success bool + success bool }{ {[]string{"a", "b", "c", "d"}, true}, {[]int{100, 200, 300}, true}, @@ -406,7 +406,6 @@ func TestShuffleRandomising(t *testing.T) { } } - func TestDictionary(t *testing.T) { for i, this := range []struct { v1 []interface{} diff --git a/tpl/template_resources_test.go b/tpl/template_resources_test.go index c847d3ba9..b28ee3502 100644 --- a/tpl/template_resources_test.go +++ b/tpl/template_resources_test.go @@ -270,7 +270,7 @@ func TestGetCSVFailParseSep(t *testing.T) { url := ts.URL + "/test.csv" defer os.Remove(getCacheFileID(url)) - want := [][]string{[]string{"gomeetup", "city"}, []string{"yes", "Sydney"}, []string{"yes", "San Francisco"}, []string{"yes", "Stockholm"}} + want := [][]string{{"gomeetup", "city"}, {"yes", "Sydney"}, {"yes", "San Francisco"}, {"yes", "Stockholm"}} have := GetCSV(",", url) assert.NotNil(t, have) if have != nil { @@ -301,7 +301,7 @@ func TestGetCSVFailParse(t *testing.T) { url := ts.URL + "/test.csv" defer os.Remove(getCacheFileID(url)) - want := [][]string{[]string{"gomeetup", "city"}, []string{"yes", "Sydney"}, []string{"yes", "San Francisco"}, []string{"yes", "Stockholm"}} + want := [][]string{{"gomeetup", "city"}, {"yes", "Sydney"}, {"yes", "San Francisco"}, {"yes", "Stockholm"}} have := GetCSV(",", url) assert.NotNil(t, have) if have != nil {