From 715d4425ade4d74cd479b2c87b0510bb6ebd0b42 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 19 Aug 2016 06:22:19 -0500 Subject: [PATCH] hugolib: Use named keys in composite literals Make `go vet` great again --- hugolib/datafiles_test.go | 27 ++++----- hugolib/handler_test.go | 18 +++--- hugolib/menu_test.go | 42 +++++++------- hugolib/site_test.go | 116 ++++++++++++++++++++------------------ hugolib/site_url_test.go | 4 +- 5 files changed, 107 insertions(+), 100 deletions(-) diff --git a/hugolib/datafiles_test.go b/hugolib/datafiles_test.go index 0f8fe8b5d..d57773579 100644 --- a/hugolib/datafiles_test.go +++ b/hugolib/datafiles_test.go @@ -14,17 +14,18 @@ package hugolib import ( - "github.com/spf13/hugo/parser" - "github.com/spf13/hugo/source" "path/filepath" "reflect" "testing" + + "github.com/spf13/hugo/parser" + "github.com/spf13/hugo/source" ) func TestDataDirJSON(t *testing.T) { sources := []source.ByteSource{ - {filepath.FromSlash("test/foo.json"), []byte(`{ "bar": "foofoo" }`)}, - {filepath.FromSlash("test.json"), []byte(`{ "hello": [ { "world": "foo" } ] }`)}, + {Name: filepath.FromSlash("test/foo.json"), Content: []byte(`{ "bar": "foofoo" }`)}, + {Name: filepath.FromSlash("test.json"), Content: []byte(`{ "hello": [ { "world": "foo" } ] }`)}, } expected, err := parser.HandleJSONMetaData([]byte(`{ "test": { "hello": [{ "world": "foo" }] , "foo": { "bar":"foofoo" } } }`)) @@ -38,7 +39,7 @@ func TestDataDirJSON(t *testing.T) { func TestDataDirToml(t *testing.T) { sources := []source.ByteSource{ - {filepath.FromSlash("test/kung.toml"), []byte("[foo]\nbar = 1")}, + {Name: filepath.FromSlash("test/kung.toml"), Content: []byte("[foo]\nbar = 1")}, } expected, err := parser.HandleTOMLMetaData([]byte("[test]\n[test.kung]\n[test.kung.foo]\nbar = 1")) @@ -53,10 +54,10 @@ func TestDataDirToml(t *testing.T) { func TestDataDirYAMLWithOverridenValue(t *testing.T) { sources := []source.ByteSource{ // filepath.Walk walks the files in lexical order, '/' comes before '.'. Simulate this: - {filepath.FromSlash("a.yaml"), []byte("a: 1")}, - {filepath.FromSlash("test/v1.yaml"), []byte("v1-2: 2")}, - {filepath.FromSlash("test/v2.yaml"), []byte("v2:\n- 2\n- 3")}, - {filepath.FromSlash("test.yaml"), []byte("v1: 1")}, + {Name: filepath.FromSlash("a.yaml"), Content: []byte("a: 1")}, + {Name: filepath.FromSlash("test/v1.yaml"), Content: []byte("v1-2: 2")}, + {Name: filepath.FromSlash("test/v2.yaml"), Content: []byte("v2:\n- 2\n- 3")}, + {Name: filepath.FromSlash("test.yaml"), Content: []byte("v1: 1")}, } expected := map[string]interface{}{"a": map[string]interface{}{"a": 1}, @@ -68,12 +69,12 @@ func TestDataDirYAMLWithOverridenValue(t *testing.T) { // issue 892 func TestDataDirMultipleSources(t *testing.T) { s1 := []source.ByteSource{ - {filepath.FromSlash("test/first.toml"), []byte("bar = 1")}, + {Name: filepath.FromSlash("test/first.toml"), Content: []byte("bar = 1")}, } s2 := []source.ByteSource{ - {filepath.FromSlash("test/first.toml"), []byte("bar = 2")}, - {filepath.FromSlash("test/second.toml"), []byte("tender = 2")}, + {Name: filepath.FromSlash("test/first.toml"), Content: []byte("bar = 2")}, + {Name: filepath.FromSlash("test/second.toml"), Content: []byte("tender = 2")}, } expected, _ := parser.HandleTOMLMetaData([]byte("[test.first]\nbar = 1\n[test.second]\ntender=2")) @@ -84,7 +85,7 @@ func TestDataDirMultipleSources(t *testing.T) { func TestDataDirUnknownFormat(t *testing.T) { sources := []source.ByteSource{ - {filepath.FromSlash("test.roml"), []byte("boo")}, + {Name: filepath.FromSlash("test.roml"), Content: []byte("boo")}, } s := &Site{} err := s.loadData([]source.Input{&source.InMemorySource{ByteSource: sources}}) diff --git a/hugolib/handler_test.go b/hugolib/handler_test.go index ee5913634..1b0a82418 100644 --- a/hugolib/handler_test.go +++ b/hugolib/handler_test.go @@ -30,15 +30,15 @@ func TestDefaultHandler(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.html"), []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, - {filepath.FromSlash("sect/doc2.html"), []byte("more content")}, - {filepath.FromSlash("sect/doc3.md"), []byte("# doc3\n*some* content")}, - {filepath.FromSlash("sect/doc4.md"), []byte("---\ntitle: doc4\n---\n# doc4\n*some content*")}, - {filepath.FromSlash("sect/doc3/img1.png"), []byte("‰PNG  ��� IHDR����������:~›U��� IDATWcø��ZMoñ����IEND®B`‚")}, - {filepath.FromSlash("sect/img2.gif"), []byte("GIF89a��€��ÿÿÿ���,�������D�;")}, - {filepath.FromSlash("sect/img2.spf"), []byte("****FAKE-FILETYPE****")}, - {filepath.FromSlash("doc7.html"), []byte("doc7 content")}, - {filepath.FromSlash("sect/doc8.html"), []byte("---\nmarkup: md\n---\n# title\nsome *content*")}, + {Name: filepath.FromSlash("sect/doc1.html"), Content: []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, + {Name: filepath.FromSlash("sect/doc2.html"), Content: []byte("more content")}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: []byte("# doc3\n*some* content")}, + {Name: filepath.FromSlash("sect/doc4.md"), Content: []byte("---\ntitle: doc4\n---\n# doc4\n*some content*")}, + {Name: filepath.FromSlash("sect/doc3/img1.png"), Content: []byte("‰PNG  ��� IHDR����������:~›U��� IDATWcø��ZMoñ����IEND®B`‚")}, + {Name: filepath.FromSlash("sect/img2.gif"), Content: []byte("GIF89a��€��ÿÿÿ���,�������D�;")}, + {Name: filepath.FromSlash("sect/img2.spf"), Content: []byte("****FAKE-FILETYPE****")}, + {Name: filepath.FromSlash("doc7.html"), Content: []byte("doc7 content")}, + {Name: filepath.FromSlash("sect/doc8.html"), Content: []byte("---\nmarkup: md\n---\n# title\nsome *content*")}, } viper.Set("DefaultExtension", "html") diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index 40fd3b842..c7a6a4f05 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -122,16 +122,16 @@ weight = 4 Front Matter with Menu Pages`) var menuPageSources = []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), menuPage1}, - {filepath.FromSlash("sect/doc2.md"), menuPage2}, - {filepath.FromSlash("sect/doc3.md"), menuPage3}, + {Name: filepath.FromSlash("sect/doc1.md"), Content: menuPage1}, + {Name: filepath.FromSlash("sect/doc2.md"), Content: menuPage2}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: menuPage3}, } var menuPageSectionsSources = []source.ByteSource{ - {filepath.FromSlash("first/doc1.md"), menuPage1}, - {filepath.FromSlash("first/doc2.md"), menuPage2}, - {filepath.FromSlash("second-section/doc3.md"), menuPage3}, - {filepath.FromSlash("Fish and Chips/doc4.md"), menuPage4}, + {Name: filepath.FromSlash("first/doc1.md"), Content: menuPage1}, + {Name: filepath.FromSlash("first/doc2.md"), Content: menuPage2}, + {Name: filepath.FromSlash("second-section/doc3.md"), Content: menuPage3}, + {Name: filepath.FromSlash("Fish and Chips/doc4.md"), Content: menuPage4}, } func tstCreateMenuPageWithNameTOML(title, menu, name string) []byte { @@ -184,15 +184,15 @@ Front Matter with Menu with Identifier`, title, menu, identifier)) func TestPageMenuWithIdentifier(t *testing.T) { toml := []source.ByteSource{ - {"sect/doc1.md", tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i1")}, - {"sect/doc2.md", tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i2")}, - {"sect/doc3.md", tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i2")}, // duplicate + {Name: "sect/doc1.md", Content: tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i1")}, + {Name: "sect/doc2.md", Content: tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i2")}, + {Name: "sect/doc3.md", Content: tstCreateMenuPageWithIdentifierTOML("t1", "m1", "i2")}, // duplicate } yaml := []source.ByteSource{ - {"sect/doc1.md", tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i1")}, - {"sect/doc2.md", tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i2")}, - {"sect/doc3.md", tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i2")}, // duplicate + {Name: "sect/doc1.md", Content: tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i1")}, + {Name: "sect/doc2.md", Content: tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i2")}, + {Name: "sect/doc3.md", Content: tstCreateMenuPageWithIdentifierYAML("t1", "m1", "i2")}, // duplicate } doTestPageMenuWithIdentifier(t, toml) @@ -224,15 +224,15 @@ func doTestPageMenuWithIdentifier(t *testing.T, menuPageSources []source.ByteSou func TestPageMenuWithDuplicateName(t *testing.T) { toml := []source.ByteSource{ - {"sect/doc1.md", tstCreateMenuPageWithNameTOML("t1", "m1", "n1")}, - {"sect/doc2.md", tstCreateMenuPageWithNameTOML("t1", "m1", "n2")}, - {"sect/doc3.md", tstCreateMenuPageWithNameTOML("t1", "m1", "n2")}, // duplicate + {Name: "sect/doc1.md", Content: tstCreateMenuPageWithNameTOML("t1", "m1", "n1")}, + {Name: "sect/doc2.md", Content: tstCreateMenuPageWithNameTOML("t1", "m1", "n2")}, + {Name: "sect/doc3.md", Content: tstCreateMenuPageWithNameTOML("t1", "m1", "n2")}, // duplicate } yaml := []source.ByteSource{ - {"sect/doc1.md", tstCreateMenuPageWithNameYAML("t1", "m1", "n1")}, - {"sect/doc2.md", tstCreateMenuPageWithNameYAML("t1", "m1", "n2")}, - {"sect/doc3.md", tstCreateMenuPageWithNameYAML("t1", "m1", "n2")}, // duplicate + {Name: "sect/doc1.md", Content: tstCreateMenuPageWithNameYAML("t1", "m1", "n1")}, + {Name: "sect/doc2.md", Content: tstCreateMenuPageWithNameYAML("t1", "m1", "n2")}, + {Name: "sect/doc3.md", Content: tstCreateMenuPageWithNameYAML("t1", "m1", "n2")}, // duplicate } doTestPageMenuWithDuplicateName(t, toml) @@ -358,8 +358,8 @@ menu: Yaml Front Matter with Menu Pages`) s := setupMenuTests(t, []source.ByteSource{ - {filepath.FromSlash("sect/yaml1.md"), ps1}, - {filepath.FromSlash("sect/yaml2.md"), ps2}}) + {Name: filepath.FromSlash("sect/yaml1.md"), Content: ps1}, + {Name: filepath.FromSlash("sect/yaml2.md"), Content: ps2}}) p1 := s.Pages[0] assert.Len(t, p1.Menus(), 2, "List YAML") diff --git a/hugolib/site_test.go b/hugolib/site_test.go index 4e68b5ff8..f06c9de81 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -241,10 +241,10 @@ func TestDraftAndFutureRender(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), []byte("---\ntitle: doc1\ndraft: true\npublishdate: \"2414-05-29\"\n---\n# doc1\n*some content*")}, - {filepath.FromSlash("sect/doc2.md"), []byte("---\ntitle: doc2\ndraft: true\npublishdate: \"2012-05-29\"\n---\n# doc2\n*some content*")}, - {filepath.FromSlash("sect/doc3.md"), []byte("---\ntitle: doc3\ndraft: false\npublishdate: \"2414-05-29\"\n---\n# doc3\n*some content*")}, - {filepath.FromSlash("sect/doc4.md"), []byte("---\ntitle: doc4\ndraft: false\npublishdate: \"2012-05-29\"\n---\n# doc4\n*some content*")}, + {Name: filepath.FromSlash("sect/doc1.md"), Content: []byte("---\ntitle: doc1\ndraft: true\npublishdate: \"2414-05-29\"\n---\n# doc1\n*some content*")}, + {Name: filepath.FromSlash("sect/doc2.md"), Content: []byte("---\ntitle: doc2\ndraft: true\npublishdate: \"2012-05-29\"\n---\n# doc2\n*some content*")}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: []byte("---\ntitle: doc3\ndraft: false\npublishdate: \"2414-05-29\"\n---\n# doc3\n*some content*")}, + {Name: filepath.FromSlash("sect/doc4.md"), Content: []byte("---\ntitle: doc4\ndraft: false\npublishdate: \"2012-05-29\"\n---\n# doc4\n*some content*")}, } siteSetup := func() *Site { @@ -302,8 +302,8 @@ func TestFutureExpirationRender(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc3.md"), []byte("---\ntitle: doc1\nexpirydate: \"2400-05-29\"\n---\n# doc1\n*some content*")}, - {filepath.FromSlash("sect/doc4.md"), []byte("---\ntitle: doc2\nexpirydate: \"2000-05-29\"\n---\n# doc2\n*some content*")}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: []byte("---\ntitle: doc1\nexpirydate: \"2400-05-29\"\n---\n# doc1\n*some content*")}, + {Name: filepath.FromSlash("sect/doc4.md"), Content: []byte("---\ntitle: doc2\nexpirydate: \"2000-05-29\"\n---\n# doc2\n*some content*")}, } siteSetup := func() *Site { @@ -380,18 +380,24 @@ func doTestCrossrefs(t *testing.T, relative, uglyURLs bool) { } sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), - []byte(fmt.Sprintf(`Ref 2: {{< %s "sect/doc2.md" >}}`, refShortcode))}, + { + Name: filepath.FromSlash("sect/doc1.md"), + Content: []byte(fmt.Sprintf(`Ref 2: {{< %s "sect/doc2.md" >}}`, refShortcode)), + }, // Issue #1148: Make sure that no P-tags is added around shortcodes. - {filepath.FromSlash("sect/doc2.md"), - []byte(fmt.Sprintf(`**Ref 1:** + { + Name: filepath.FromSlash("sect/doc2.md"), + Content: []byte(fmt.Sprintf(`**Ref 1:** {{< %s "sect/doc1.md" >}} -THE END.`, refShortcode))}, +THE END.`, refShortcode)), + }, // Issue #1753: Should not add a trailing newline after shortcode. - {filepath.FromSlash("sect/doc3.md"), - []byte(fmt.Sprintf(`**Ref 1:**{{< %s "sect/doc3.md" >}}.`, refShortcode))}, + { + Name: filepath.FromSlash("sect/doc3.md"), + Content: []byte(fmt.Sprintf(`**Ref 1:**{{< %s "sect/doc3.md" >}}.`, refShortcode)), + }, } s := &Site{ @@ -456,8 +462,8 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) { viper.Set("UglyURLs", uglyURLs) sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, - {filepath.FromSlash("sect/doc2.md"), []byte("---\nurl: /ugly.html\nmarkup: markdown\n---\n# title\ndoc2 *content*")}, + {Name: filepath.FromSlash("sect/doc1.md"), Content: []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, + {Name: filepath.FromSlash("sect/doc2.md"), Content: []byte("---\nurl: /ugly.html\nmarkup: markdown\n---\n# title\ndoc2 *content*")}, } s := &Site{ @@ -548,9 +554,9 @@ func doTestSectionNaming(t *testing.T, canonify, uglify, pluralize bool) { } sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.html"), []byte("doc1")}, - {filepath.FromSlash("Fish and Chips/doc2.html"), []byte("doc2")}, - {filepath.FromSlash("ラーメン/doc3.html"), []byte("doc3")}, + {Name: filepath.FromSlash("sect/doc1.html"), Content: []byte("doc1")}, + {Name: filepath.FromSlash("Fish and Chips/doc2.html"), Content: []byte("doc2")}, + {Name: filepath.FromSlash("ラーメン/doc3.html"), Content: []byte("doc3")}, } s := &Site{ @@ -603,14 +609,14 @@ func TestSkipRender(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.html"), []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, - {filepath.FromSlash("sect/doc2.html"), []byte("more content")}, - {filepath.FromSlash("sect/doc3.md"), []byte("# doc3\n*some* content")}, - {filepath.FromSlash("sect/doc4.md"), []byte("---\ntitle: doc4\n---\n# doc4\n*some content*")}, - {filepath.FromSlash("sect/doc5.html"), []byte("{{ template \"head\" }}body5")}, - {filepath.FromSlash("sect/doc6.html"), []byte("{{ template \"head_abs\" }}body5")}, - {filepath.FromSlash("doc7.html"), []byte("doc7 content")}, - {filepath.FromSlash("sect/doc8.html"), []byte("---\nmarkup: md\n---\n# title\nsome *content*")}, + {Name: filepath.FromSlash("sect/doc1.html"), Content: []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")}, + {Name: filepath.FromSlash("sect/doc2.html"), Content: []byte("more content")}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: []byte("# doc3\n*some* content")}, + {Name: filepath.FromSlash("sect/doc4.md"), Content: []byte("---\ntitle: doc4\n---\n# doc4\n*some content*")}, + {Name: filepath.FromSlash("sect/doc5.html"), Content: []byte("{{ template \"head\" }}body5")}, + {Name: filepath.FromSlash("sect/doc6.html"), Content: []byte("{{ template \"head_abs\" }}body5")}, + {Name: filepath.FromSlash("doc7.html"), Content: []byte("doc7 content")}, + {Name: filepath.FromSlash("sect/doc8.html"), Content: []byte("---\nmarkup: md\n---\n# title\nsome *content*")}, } viper.Set("DefaultExtension", "html") @@ -667,8 +673,8 @@ func TestAbsURLify(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.html"), []byte("link")}, - {filepath.FromSlash("content/blue/doc2.html"), []byte("---\nf: t\n---\nmore content")}, + {Name: filepath.FromSlash("sect/doc1.html"), Content: []byte("link")}, + {Name: filepath.FromSlash("content/blue/doc2.html"), Content: []byte("---\nf: t\n---\nmore content")}, } for _, baseURL := range []string{"http://auth/bub", "http://base", "//base"} { for _, canonify := range []bool{true, false} { @@ -767,10 +773,10 @@ my_date = 2010-05-27T07:32:00Z Front Matter with Ordered Pages 4. This is longer content`) var weightedSources = []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), weightedPage1}, - {filepath.FromSlash("sect/doc2.md"), weightedPage2}, - {filepath.FromSlash("sect/doc3.md"), weightedPage3}, - {filepath.FromSlash("sect/doc4.md"), weightedPage4}, + {Name: filepath.FromSlash("sect/doc1.md"), Content: weightedPage1}, + {Name: filepath.FromSlash("sect/doc2.md"), Content: weightedPage2}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: weightedPage3}, + {Name: filepath.FromSlash("sect/doc4.md"), Content: weightedPage4}, } func TestOrderedPages(t *testing.T) { @@ -835,10 +841,10 @@ func TestOrderedPages(t *testing.T) { } var groupedSources = []source.ByteSource{ - {filepath.FromSlash("sect1/doc1.md"), weightedPage1}, - {filepath.FromSlash("sect1/doc2.md"), weightedPage2}, - {filepath.FromSlash("sect2/doc3.md"), weightedPage3}, - {filepath.FromSlash("sect3/doc4.md"), weightedPage4}, + {Name: filepath.FromSlash("sect1/doc1.md"), Content: weightedPage1}, + {Name: filepath.FromSlash("sect1/doc2.md"), Content: weightedPage2}, + {Name: filepath.FromSlash("sect2/doc3.md"), Content: weightedPage3}, + {Name: filepath.FromSlash("sect3/doc4.md"), Content: weightedPage4}, } func TestGroupedPages(t *testing.T) { @@ -1033,9 +1039,9 @@ func TestWeightedTaxonomies(t *testing.T) { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("sect/doc1.md"), pageWithWeightedTaxonomies2}, - {filepath.FromSlash("sect/doc2.md"), pageWithWeightedTaxonomies1}, - {filepath.FromSlash("sect/doc3.md"), pageWithWeightedTaxonomies3}, + {Name: filepath.FromSlash("sect/doc1.md"), Content: pageWithWeightedTaxonomies2}, + {Name: filepath.FromSlash("sect/doc2.md"), Content: pageWithWeightedTaxonomies1}, + {Name: filepath.FromSlash("sect/doc3.md"), Content: pageWithWeightedTaxonomies3}, } taxonomies := make(map[string]string) @@ -1086,26 +1092,26 @@ func findPage(site *Site, f string) *Page { func setupLinkingMockSite(t *testing.T) *Site { hugofs.InitMemFs() sources := []source.ByteSource{ - {filepath.FromSlash("index.md"), []byte("")}, - {filepath.FromSlash("rootfile.md"), []byte("")}, - {filepath.FromSlash("root-image.png"), []byte("")}, + {Name: filepath.FromSlash("index.md"), Content: []byte("")}, + {Name: filepath.FromSlash("rootfile.md"), Content: []byte("")}, + {Name: filepath.FromSlash("root-image.png"), Content: []byte("")}, - {filepath.FromSlash("level2/2-root.md"), []byte("")}, - {filepath.FromSlash("level2/index.md"), []byte("")}, - {filepath.FromSlash("level2/common.md"), []byte("")}, + {Name: filepath.FromSlash("level2/2-root.md"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/index.md"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/common.md"), Content: []byte("")}, - // {filepath.FromSlash("level2b/2b-root.md"), []byte("")}, - // {filepath.FromSlash("level2b/index.md"), []byte("")}, - // {filepath.FromSlash("level2b/common.md"), []byte("")}, + // {Name: filepath.FromSlash("level2b/2b-root.md"), Content: []byte("")}, + // {Name: filepath.FromSlash("level2b/index.md"), Content: []byte("")}, + // {Name: filepath.FromSlash("level2b/common.md"), Content: []byte("")}, - {filepath.FromSlash("level2/2-image.png"), []byte("")}, - {filepath.FromSlash("level2/common.png"), []byte("")}, + {Name: filepath.FromSlash("level2/2-image.png"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/common.png"), Content: []byte("")}, - {filepath.FromSlash("level2/level3/3-root.md"), []byte("")}, - {filepath.FromSlash("level2/level3/index.md"), []byte("")}, - {filepath.FromSlash("level2/level3/common.md"), []byte("")}, - {filepath.FromSlash("level2/level3/3-image.png"), []byte("")}, - {filepath.FromSlash("level2/level3/common.png"), []byte("")}, + {Name: filepath.FromSlash("level2/level3/3-root.md"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/level3/index.md"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/level3/common.md"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/level3/3-image.png"), Content: []byte("")}, + {Name: filepath.FromSlash("level2/level3/common.png"), Content: []byte("")}, } viper.Set("baseurl", "http://auth/") diff --git a/hugolib/site_url_test.go b/hugolib/site_url_test.go index 57b3e7071..c910c918d 100644 --- a/hugolib/site_url_test.go +++ b/hugolib/site_url_test.go @@ -54,8 +54,8 @@ func (t *InMemoryAliasTarget) Publish(label string, permalink template.HTML) (er } var urlFakeSource = []source.ByteSource{ - {filepath.FromSlash("content/blue/doc1.md"), []byte(slugDoc1)}, - {filepath.FromSlash("content/blue/doc2.md"), []byte(slugDoc2)}, + {Name: filepath.FromSlash("content/blue/doc1.md"), Content: []byte(slugDoc1)}, + {Name: filepath.FromSlash("content/blue/doc2.md"), Content: []byte(slugDoc2)}, } // Issue #1105