diff options
author | Cameron Moore <[email protected]> | 2017-09-25 21:25:33 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2017-09-29 16:23:16 +0200 |
commit | 47fdfd5196cd24a23b30afe1d88969ffb413ab59 (patch) | |
tree | e2b4dc5bb5341ab2d8588879fb733ee888b9164b /related | |
parent | d45e358a0543d987091ef54b56eadd9cebda2e0f (diff) | |
download | hugo-47fdfd5196cd24a23b30afe1d88969ffb413ab59.tar.gz hugo-47fdfd5196cd24a23b30afe1d88969ffb413ab59.zip |
Clean up lint in various packages
Changes fall into one of the following:
- gofmt -s
- receiver name is inconsistent
- omit unused 2nd value from range
- godoc comment formed incorrectly
- err assigned and not used
- if block ends with a return statement followed by else
Diffstat (limited to 'related')
-rw-r--r-- | related/inverted_index.go | 2 | ||||
-rw-r--r-- | related/inverted_index_test.go | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/related/inverted_index.go b/related/inverted_index.go index f0d598d33..4f0dba7d6 100644 --- a/related/inverted_index.go +++ b/related/inverted_index.go @@ -418,7 +418,7 @@ func DecodeConfig(in interface{}) (Config, error) { } if c.ToLower { - for i, _ := range c.Indices { + for i := range c.Indices { c.Indices[i].ToLower = true } } diff --git a/related/inverted_index_test.go b/related/inverted_index_test.go index 781a969fb..2e6b90bbf 100644 --- a/related/inverted_index_test.go +++ b/related/inverted_index_test.go @@ -27,9 +27,9 @@ type testDoc struct { date time.Time } -func (k *testDoc) String() string { +func (d *testDoc) String() string { s := "\n" - for k, v := range k.keywords { + for k, v := range d.keywords { s += k + ":\t\t" for _, vv := range v { s += " " + vv.String() @@ -49,7 +49,7 @@ func newTestDoc(name string, keywords ...string) *testDoc { return kw } -func (t *testDoc) addKeywords(name string, keywords ...string) *testDoc { +func (d *testDoc) addKeywords(name string, keywords ...string) *testDoc { keywordm := createTestKeywords(name, keywords...) for k, v := range keywordm { @@ -57,9 +57,9 @@ func (t *testDoc) addKeywords(name string, keywords ...string) *testDoc { for i := 0; i < len(v); i++ { keywords[i] = StringKeyword(v[i]) } - t.keywords[k] = keywords + d.keywords[k] = keywords } - return t + return d } func createTestKeywords(name string, keywords ...string) map[string][]string { @@ -68,12 +68,12 @@ func createTestKeywords(name string, keywords ...string) map[string][]string { } } -func (k *testDoc) SearchKeywords(cfg IndexConfig) ([]Keyword, error) { - return k.keywords[cfg.Name], nil +func (d *testDoc) SearchKeywords(cfg IndexConfig) ([]Keyword, error) { + return d.keywords[cfg.Name], nil } -func (k *testDoc) PubDate() time.Time { - return k.date +func (d *testDoc) PubDate() time.Time { + return d.date } func TestSearch(t *testing.T) { |