From 937592cb85f6b4bf4603230050ac0afdcc93058b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 23 Mar 2016 10:10:28 +0100 Subject: [PATCH] hugolib: Fix some more Golint warnings --- hugolib/page_taxonomy_test.go | 20 ++++++++++---------- hugolib/shortcode_test.go | 2 +- hugolib/sitemap.go | 1 + hugolib/taxonomy_test.go | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hugolib/page_taxonomy_test.go b/hugolib/page_taxonomy_test.go index d463e5800..30efd8c7f 100644 --- a/hugolib/page_taxonomy_test.go +++ b/hugolib/page_taxonomy_test.go @@ -18,13 +18,13 @@ import ( "testing" ) -var PAGE_YAML_WITH_TAXONOMIES_A = `--- +var pageYamlWithTaxonomiesA = `--- tags: ['a', 'B', 'c'] categories: 'd' --- YAML frontmatter with tags and categories taxonomy.` -var PAGE_YAML_WITH_TAXONOMIES_B = `--- +var pageYamlWithTaxonomiesB = `--- tags: - "a" - "B" @@ -33,13 +33,13 @@ categories: 'd' --- YAML frontmatter with tags and categories taxonomy.` -var PAGE_YAML_WITH_TAXONOMIES_C = `--- +var pageYamlWithTaxonomiesC = `--- tags: 'E' categories: 'd' --- YAML frontmatter with tags and categories taxonomy.` -var PAGE_JSON_WITH_TAXONOMIES = `{ +var pageJSONWithTaxonomies = `{ "categories": "D", "tags": [ "a", @@ -49,18 +49,18 @@ var PAGE_JSON_WITH_TAXONOMIES = `{ } JSON Front Matter with tags and categories` -var PAGE_TOML_WITH_TAXONOMIES = `+++ +var pageTomlWithTaxonomies = `+++ tags = [ "a", "B", "c" ] categories = "d" +++ TOML Front Matter with tags and categories` func TestParseTaxonomies(t *testing.T) { - for _, test := range []string{PAGE_TOML_WITH_TAXONOMIES, - PAGE_JSON_WITH_TAXONOMIES, - PAGE_YAML_WITH_TAXONOMIES_A, - PAGE_YAML_WITH_TAXONOMIES_B, - PAGE_YAML_WITH_TAXONOMIES_C, + for _, test := range []string{pageTomlWithTaxonomies, + pageJSONWithTaxonomies, + pageYamlWithTaxonomiesA, + pageYamlWithTaxonomiesB, + pageYamlWithTaxonomiesC, } { p, _ := NewPage("page/with/taxonomy") diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 3c13fa298..544cc4baa 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -534,7 +534,7 @@ func BenchmarkReplaceShortcodeTokens(b *testing.B) { {strings.Repeat("A ", 3000) + " {#{#HUGOSHORTCODE-1#}#}." + strings.Repeat("BC ", 1000) + " {#{#HUGOSHORTCODE-1#}#}.", map[string]string{"{#{#HUGOSHORTCODE-1#}#}": "Hello World"}, []byte(strings.Repeat("A ", 3000) + " Hello World." + strings.Repeat("BC ", 1000) + " Hello World.")}, } - var in []input = make([]input, b.N*len(data)) + var in = make([]input, b.N*len(data)) var cnt = 0 for i := 0; i < b.N; i++ { for _, this := range data { diff --git a/hugolib/sitemap.go b/hugolib/sitemap.go index 54e1d076e..64d6f5b7a 100644 --- a/hugolib/sitemap.go +++ b/hugolib/sitemap.go @@ -18,6 +18,7 @@ import ( jww "github.com/spf13/jwalterweatherman" ) +// Sitemap configures the sitemap to be generated. type Sitemap struct { ChangeFreq string Priority float64 diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go index 047263e78..005be33b1 100644 --- a/hugolib/taxonomy_test.go +++ b/hugolib/taxonomy_test.go @@ -20,7 +20,7 @@ import ( func TestSitePossibleTaxonomies(t *testing.T) { site := new(Site) - page, _ := NewPageFrom(strings.NewReader(PAGE_YAML_WITH_TAXONOMIES_A), "path/to/page") + page, _ := NewPageFrom(strings.NewReader(pageYamlWithTaxonomiesA), "path/to/page") site.Pages = append(site.Pages, page) taxonomies := site.possibleTaxonomies() if !compareStringSlice(taxonomies, []string{"tags", "categories"}) {