Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-18 00:03:27 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-18 00:03:27 +0300
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /hugolib
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/alias_test.go12
-rw-r--r--hugolib/cascade_test.go50
-rw-r--r--hugolib/collections.go4
-rw-r--r--hugolib/config_test.go34
-rw-r--r--hugolib/configdir_test.go4
-rw-r--r--hugolib/content_map.go52
-rw-r--r--hugolib/content_map_page.go26
-rw-r--r--hugolib/datafiles_test.go98
-rw-r--r--hugolib/embedded_shortcodes_test.go24
-rw-r--r--hugolib/filesystems/basefs_test.go16
-rw-r--r--hugolib/hugo_sites.go32
-rw-r--r--hugolib/hugo_sites_build_test.go10
-rw-r--r--hugolib/image_test.go2
-rw-r--r--hugolib/language_content_dir_test.go2
-rw-r--r--hugolib/page.go10
-rw-r--r--hugolib/page__content.go2
-rw-r--r--hugolib/page__data.go2
-rw-r--r--hugolib/page__meta.go40
-rw-r--r--hugolib/page__new.go6
-rw-r--r--hugolib/page__paginator.go4
-rw-r--r--hugolib/page__per_output.go20
-rw-r--r--hugolib/page__ref.go14
-rw-r--r--hugolib/page__tree.go6
-rw-r--r--hugolib/page_test.go30
-rw-r--r--hugolib/page_unwrap.go4
-rw-r--r--hugolib/page_unwrap_test.go2
-rw-r--r--hugolib/pagebundler_test.go16
-rw-r--r--hugolib/pages_capture_test.go4
-rw-r--r--hugolib/pages_language_merge_test.go2
-rw-r--r--hugolib/pages_process.go14
-rw-r--r--hugolib/paths/paths_test.go6
-rw-r--r--hugolib/resource_chain_test.go2
-rw-r--r--hugolib/shortcode.go30
-rw-r--r--hugolib/shortcode_test.go16
-rw-r--r--hugolib/site.go36
-rw-r--r--hugolib/site_output.go2
-rw-r--r--hugolib/site_output_test.go16
-rw-r--r--hugolib/site_render.go2
-rw-r--r--hugolib/site_test.go10
-rw-r--r--hugolib/sitemap_test.go2
-rw-r--r--hugolib/testhelpers_test.go10
41 files changed, 337 insertions, 337 deletions
diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go
index 8c00f8360..124c9f4ca 100644
--- a/hugolib/alias_test.go
+++ b/hugolib/alias_test.go
@@ -51,13 +51,13 @@ func TestAlias(t *testing.T) {
fileSuffix string
urlPrefix string
urlSuffix string
- settings map[string]interface{}
+ settings map[string]any
}{
- {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com"}},
- {"/index.html", "http://example.com/some/path", "/", map[string]interface{}{"baseURL": "http://example.com/some/path"}},
- {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com", "canonifyURLs": true}},
- {"/index.html", "../..", "/", map[string]interface{}{"relativeURLs": true}},
- {".html", "", ".html", map[string]interface{}{"uglyURLs": true}},
+ {"/index.html", "http://example.com", "/", map[string]any{"baseURL": "http://example.com"}},
+ {"/index.html", "http://example.com/some/path", "/", map[string]any{"baseURL": "http://example.com/some/path"}},
+ {"/index.html", "http://example.com", "/", map[string]any{"baseURL": "http://example.com", "canonifyURLs": true}},
+ {"/index.html", "../..", "/", map[string]any{"relativeURLs": true}},
+ {".html", "", ".html", map[string]any{"uglyURLs": true}},
}
for _, test := range tests {
diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go
index b7ca45290..c218aa282 100644
--- a/hugolib/cascade_test.go
+++ b/hugolib/cascade_test.go
@@ -335,7 +335,7 @@ Banner: post.jpg`,
}
func newCascadeTestBuilder(t testing.TB, langs []string) *sitesBuilder {
- p := func(m map[string]interface{}) string {
+ p := func(m map[string]any) string {
var yamlStr string
if len(m) > 0 {
@@ -392,76 +392,76 @@ defaultContentLanguageInSubDir = false
}
withContent(
- "_index.md", p(map[string]interface{}{
+ "_index.md", p(map[string]any{
"title": "Home",
- "cascade": map[string]interface{}{
+ "cascade": map[string]any{
"title": "Cascade Home",
"ICoN": "home.png",
"outputs": []string{"HTML"},
"weight": 42,
},
}),
- "p1.md", p(map[string]interface{}{
+ "p1.md", p(map[string]any{
"title": "p1",
}),
- "p2.md", p(map[string]interface{}{}),
- "sect1/_index.md", p(map[string]interface{}{
+ "p2.md", p(map[string]any{}),
+ "sect1/_index.md", p(map[string]any{
"title": "Sect1",
"type": "stype",
- "cascade": map[string]interface{}{
+ "cascade": map[string]any{
"title": "Cascade Sect1",
"icon": "sect1.png",
"type": "stype",
"categories": []string{"catsect1"},
},
}),
- "sect1/s1_2/_index.md", p(map[string]interface{}{
+ "sect1/s1_2/_index.md", p(map[string]any{
"title": "Sect1_2",
}),
- "sect1/s1_2/p1.md", p(map[string]interface{}{
+ "sect1/s1_2/p1.md", p(map[string]any{
"title": "Sect1_2_p1",
}),
- "sect1/s1_2/p2.md", p(map[string]interface{}{
+ "sect1/s1_2/p2.md", p(map[string]any{
"title": "Sect1_2_p2",
}),
- "sect2/_index.md", p(map[string]interface{}{
+ "sect2/_index.md", p(map[string]any{
"title": "Sect2",
}),
- "sect2/p1.md", p(map[string]interface{}{
+ "sect2/p1.md", p(map[string]any{
"title": "Sect2_p1",
"categories": []string{"cool", "funny", "sad"},
"tags": []string{"blue", "green"},
}),
- "sect2/p2.md", p(map[string]interface{}{}),
- "sect3/p1.md", p(map[string]interface{}{}),
+ "sect2/p2.md", p(map[string]any{}),
+ "sect3/p1.md", p(map[string]any{}),
// No front matter, see #6855
"sect3/nofrontmatter.md", `**Hello**`,
"sectnocontent/p1.md", `**Hello**`,
"sectnofrontmatter/_index.md", `**Hello**`,
- "sect4/_index.md", p(map[string]interface{}{
+ "sect4/_index.md", p(map[string]any{
"title": "Sect4",
- "cascade": map[string]interface{}{
+ "cascade": map[string]any{
"weight": 52,
"outputs": []string{"RSS"},
},
}),
- "sect4/p1.md", p(map[string]interface{}{}),
- "p2.md", p(map[string]interface{}{}),
- "bundle1/index.md", p(map[string]interface{}{}),
- "bundle1/bp1.md", p(map[string]interface{}{}),
- "categories/_index.md", p(map[string]interface{}{
+ "sect4/p1.md", p(map[string]any{}),
+ "p2.md", p(map[string]any{}),
+ "bundle1/index.md", p(map[string]any{}),
+ "bundle1/bp1.md", p(map[string]any{}),
+ "categories/_index.md", p(map[string]any{
"title": "My Categories",
- "cascade": map[string]interface{}{
+ "cascade": map[string]any{
"title": "Cascade Category",
"icoN": "cat.png",
"weight": 12,
},
}),
- "categories/cool/_index.md", p(map[string]interface{}{}),
- "categories/sad/_index.md", p(map[string]interface{}{
- "cascade": map[string]interface{}{
+ "categories/cool/_index.md", p(map[string]any{}),
+ "categories/sad/_index.md", p(map[string]any{
+ "cascade": map[string]any{
"icon": "sad.png",
"weight": 32,
},
diff --git a/hugolib/collections.go b/hugolib/collections.go
index 9b4f83cc6..933f7dadc 100644
--- a/hugolib/collections.go
+++ b/hugolib/collections.go
@@ -28,7 +28,7 @@ var (
// implementations have no value on their own.
// Slice is not meant to be used externally. It's a bridge function
-func (p *pageState) Slice(items interface{}) (interface{}, error) {
+func (p *pageState) Slice(items any) (any, error) {
return page.ToPages(items)
}
@@ -37,7 +37,7 @@ func (p *pageState) Slice(items interface{}) (interface{}, error) {
// Group creates a PageGroup from a key and a Pages object
// This method is not meant for external use. It got its non-typed arguments to satisfy
// a very generic interface in the tpl package.
-func (p *pageState) Group(key interface{}, in interface{}) (interface{}, error) {
+func (p *pageState) Group(key any, in any) (any, error) {
pages, err := page.ToPages(in)
if err != nil {
return nil, err
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index bbf821232..222568b7c 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -250,12 +250,12 @@ name = "menu-theme"
b.Assert(got["mediatypes"], qt.DeepEquals, maps.Params{
"text/m2": maps.Params{
- "suffixes": []interface{}{
+ "suffixes": []any{
"m2theme",
},
},
"text/m1": maps.Params{
- "suffixes": []interface{}{
+ "suffixes": []any{
"m1main",
},
},
@@ -293,13 +293,13 @@ name = "menu-theme"
"pl1": "p1-en-main",
},
"menus": maps.Params{
- "main": []interface{}{
- map[string]interface{}{
+ "main": []any{
+ map[string]any{
"name": "menu-lang-en-main",
},
},
- "theme": []interface{}{
- map[string]interface{}{
+ "theme": []any{
+ map[string]any{
"name": "menu-lang-en-theme",
},
},
@@ -313,18 +313,18 @@ name = "menu-theme"
"pl2": "p2-nb-theme",
},
"menus": maps.Params{
- "main": []interface{}{
- map[string]interface{}{
+ "main": []any{
+ map[string]any{
"name": "menu-lang-nb-main",
},
},
- "theme": []interface{}{
- map[string]interface{}{
+ "theme": []any{
+ map[string]any{
"name": "menu-lang-nb-theme",
},
},
- "top": []interface{}{
- map[string]interface{}{
+ "top": []any{
+ map[string]any{
"name": "menu-lang-nb-top",
},
},
@@ -399,8 +399,8 @@ name = "menu-theme"
"en": maps.Params{
"languagename": "English",
"menus": maps.Params{
- "main": []interface{}{
- map[string]interface{}{
+ "main": []any{
+ map[string]any{
"name": "menu-theme",
},
},
@@ -710,9 +710,9 @@ theme_param="themevalue2"
c.Assert(cfg.Get("imaging.anchor"), qt.Equals, "top")
c.Assert(cfg.Get("imaging.quality"), qt.Equals, int64(75))
c.Assert(cfg.Get("imaging.resamplefilter"), qt.Equals, "CatmullRom")
- c.Assert(cfg.Get("stringSlice"), qt.DeepEquals, []interface{}{"c", "d"})
- c.Assert(cfg.Get("floatSlice"), qt.DeepEquals, []interface{}{5.32})
- c.Assert(cfg.Get("intSlice"), qt.DeepEquals, []interface{}{5, 8, 9})
+ c.Assert(cfg.Get("stringSlice"), qt.DeepEquals, []any{"c", "d"})
+ c.Assert(cfg.Get("floatSlice"), qt.DeepEquals, []any{5.32})
+ c.Assert(cfg.Get("intSlice"), qt.DeepEquals, []any{5, 8, 9})
c.Assert(cfg.Get("params.api_config.api_key"), qt.Equals, "new_key")
c.Assert(cfg.Get("params.api_config.another_key"), qt.Equals, "default another_key")
c.Assert(cfg.Get("params.mytheme_section.theme_param"), qt.Equals, "themevalue_changed")
diff --git a/hugolib/configdir_test.go b/hugolib/configdir_test.go
index b3fc71e58..998010318 100644
--- a/hugolib/configdir_test.go
+++ b/hugolib/configdir_test.go
@@ -119,10 +119,10 @@ p3 = "p3params_no_production"
c.Assert(cfg.GetString("params.p3"), qt.Equals, "p3params_development")
c.Assert(cfg.GetString("languages.no.params.p3"), qt.Equals, "p3params_no_development")
- c.Assert(len(cfg.Get("menus.docs").([]interface{})), qt.Equals, 2)
+ c.Assert(len(cfg.Get("menus.docs").([]any)), qt.Equals, 2)
noMenus := cfg.Get("languages.no.menus.docs")
c.Assert(noMenus, qt.Not(qt.IsNil))
- c.Assert(len(noMenus.([]interface{})), qt.Equals, 1)
+ c.Assert(len(noMenus.([]any)), qt.Equals, 1)
}
func TestLoadConfigDirError(t *testing.T) {
diff --git a/hugolib/content_map.go b/hugolib/content_map.go
index 29e821f75..330391dcb 100644
--- a/hugolib/content_map.go
+++ b/hugolib/content_map.go
@@ -83,7 +83,7 @@ func newContentMap(cfg contentMapConfig) *contentMap {
m.sections, m.taxonomies,
}
- addToReverseMap := func(k string, n *contentNode, m map[interface{}]*contentNode) {
+ addToReverseMap := func(k string, n *contentNode, m map[any]*contentNode) {
k = strings.ToLower(k)
existing, found := m[k]
if found && existing != ambiguousContentNode {
@@ -96,8 +96,8 @@ func newContentMap(cfg contentMapConfig) *contentMap {
m.pageReverseIndex = &contentTreeReverseIndex{
t: []*contentTree{m.pages, m.sections, m.taxonomies},
contentTreeReverseIndexMap: &contentTreeReverseIndexMap{
- initFn: func(t *contentTree, m map[interface{}]*contentNode) {
- t.Walk(func(s string, v interface{}) bool {
+ initFn: func(t *contentTree, m map[any]*contentNode) {
+ t.Walk(func(s string, v any) bool {
n := v.(*contentNode)
if n.p != nil && !n.p.File().IsZero() {
meta := n.p.File().FileInfo().Meta()
@@ -396,7 +396,7 @@ func (m *contentMap) AddFilesBundle(header hugofs.FileMetaInfo, resources ...hug
func (m *contentMap) CreateMissingNodes() error {
// Create missing home and root sections
- rootSections := make(map[string]interface{})
+ rootSections := make(map[string]any)
trackRootSection := func(s string, b *contentNode) {
parts := strings.Split(s, "/")
if len(parts) > 2 {
@@ -409,7 +409,7 @@ func (m *contentMap) CreateMissingNodes() error {
}
}
- m.sections.Walk(func(s string, v interface{}) bool {
+ m.sections.Walk(func(s string, v any) bool {
n := v.(*contentNode)
if s == "/" {
@@ -420,7 +420,7 @@ func (m *contentMap) CreateMissingNodes() error {
return false
})
- m.pages.Walk(func(s string, v interface{}) bool {
+ m.pages.Walk(func(s string, v any) bool {
trackRootSection(s, v.(*contentNode))
return false
})
@@ -614,7 +614,7 @@ func (m *contentMap) deleteBundleMatching(matches func(b *contentNode) bool) {
func (m *contentMap) deleteOrphanSections() {
var sectionsToDelete []string
- m.sections.Walk(func(s string, v interface{}) bool {
+ m.sections.Walk(func(s string, v any) bool {
n := v.(*contentNode)
if n.fi != nil {
@@ -658,7 +658,7 @@ func (m *contentMap) deleteSectionByPath(s string) {
}
func (m *contentMap) deletePageByPath(s string) {
- m.pages.Walk(func(s string, v interface{}) bool {
+ m.pages.Walk(func(s string, v any) bool {
fmt.Println("S", s)
return false
@@ -689,14 +689,14 @@ func (m *contentMap) testDump() string {
for i, r := range []*contentTree{m.pages, m.sections, m.resources} {
sb.WriteString(fmt.Sprintf("Tree %d:\n", i))
- r.Walk(func(s string, v interface{}) bool {
+ r.Walk(func(s string, v any) bool {
sb.WriteString("\t" + s + "\n")
return false
})
}
for i, r := range []*contentTree{m.pages, m.sections} {
- r.Walk(func(s string, v interface{}) bool {
+ r.Walk(func(s string, v any) bool {
c := v.(*contentNode)
cpToString := func(c *contentNode) string {
var sb strings.Builder
@@ -715,13 +715,13 @@ func (m *contentMap) testDump() string {
if i == 1 {
resourcesPrefix += cmLeafSeparator
- m.pages.WalkPrefix(s+cmBranchSeparator, func(s string, v interface{}) bool {
+ m.pages.WalkPrefix(s+cmBranchSeparator, func(s string, v any) bool {
sb.WriteString("\t - P: " + filepath.ToSlash((v.(*contentNode).fi.(hugofs.FileMetaInfo)).Meta().Filename) + "\n")
return false
})
}
- m.resources.WalkPrefix(resourcesPrefix, func(s string, v interface{}) bool {
+ m.resources.WalkPrefix(resourcesPrefix, func(s string, v any) bool {
sb.WriteString("\t - R: " + filepath.ToSlash((v.(*contentNode).fi.(hugofs.FileMetaInfo)).Meta().Filename) + "\n")
return false
})
@@ -791,7 +791,7 @@ type contentTrees []*contentTree
func (t contentTrees) DeletePrefix(prefix string) int {
var count int
for _, tree := range t {
- tree.Walk(func(s string, v interface{}) bool {
+ tree.Walk(func(s string, v any) bool {
return false
})
count += tree.DeletePrefix(prefix)
@@ -836,7 +836,7 @@ func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallba
filter = contentTreeNoListAlwaysFilter
}
if query.Prefix != "" {
- c.WalkBelow(query.Prefix, func(s string, v interface{}) bool {
+ c.WalkBelow(query.Prefix, func(s string, v any) bool {
n := v.(*contentNode)
if filter != nil && filter(s, n) {
return false
@@ -847,7 +847,7 @@ func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallba
return
}
- c.Walk(func(s string, v interface{}) bool {
+ c.Walk(func(s string, v any) bool {
n := v.(*contentNode)
if filter != nil && filter(s, n) {
return false
@@ -872,7 +872,7 @@ func (c contentTrees) WalkLinkable(fn contentTreeNodeCallback) {
func (c contentTrees) Walk(fn contentTreeNodeCallback) {
for _, tree := range c {
- tree.Walk(func(s string, v interface{}) bool {
+ tree.Walk(func(s string, v any) bool {
n := v.(*contentNode)
return fn(s, n)
})
@@ -881,7 +881,7 @@ func (c contentTrees) Walk(fn contentTreeNodeCallback) {
func (c contentTrees) WalkPrefix(prefix string, fn contentTreeNodeCallback) {
for _, tree := range c {
- tree.WalkPrefix(prefix, func(s string, v interface{}) bool {
+ tree.WalkPrefix(prefix, func(s string, v any) bool {
n := v.(*contentNode)
return fn(s, n)
})
@@ -891,7 +891,7 @@ func (c contentTrees) WalkPrefix(prefix string, fn contentTreeNodeCallback) {
// WalkBelow walks the tree below the given prefix, i.e. it skips the
// node with the given prefix as key.
func (c *contentTree) WalkBelow(prefix string, fn radix.WalkFn) {
- c.Tree.WalkPrefix(prefix, func(s string, v interface{}) bool {
+ c.Tree.WalkPrefix(prefix, func(s string, v any) bool {
if s == prefix {
return false
}
@@ -901,7 +901,7 @@ func (c *contentTree) WalkBelow(prefix string, fn radix.WalkFn) {
func (c *contentTree) getMatch(matches func(b *contentNode) bool) string {
var match string
- c.Walk(func(s string, v interface{}) bool {
+ c.Walk(func(s string, v any) bool {
n, ok := v.(*contentNode)
if !ok {
return false
@@ -920,7 +920,7 @@ func (c *contentTree) getMatch(matches func(b *contentNode) bool) string {
func (c *contentTree) hasBelow(s1 string) bool {
var t bool
- c.WalkBelow(s1, func(s2 string, v interface{}) bool {
+ c.WalkBelow(s1, func(s2 string, v any) bool {
t = true
return true
})
@@ -928,14 +928,14 @@ func (c *contentTree) hasBelow(s1 string) bool {
}
func (c *contentTree) printKeys() {
- c.Walk(func(s string, v interface{}) bool {
+ c.Walk(func(s string, v any) bool {
fmt.Println(s)
return false
})
}
func (c *contentTree) printKeysPrefix(prefix string) {
- c.WalkPrefix(prefix, func(s string, v interface{}) bool {
+ c.WalkPrefix(prefix, func(s string, v any) bool {
fmt.Println(s)
return false
})
@@ -1040,9 +1040,9 @@ type contentTreeReverseIndex struct {
}
type contentTreeReverseIndexMap struct {
- m map[interface{}]*contentNode
+ m map[any]*contentNode
init sync.Once
- initFn func(*contentTree, map[interface{}]*contentNode)
+ initFn func(*contentTree, map[any]*contentNode)
}
func (c *contentTreeReverseIndex) Reset() {
@@ -1051,9 +1051,9 @@ func (c *contentTreeReverseIndex) Reset() {
}
}
-func (c *contentTreeReverseIndex) Get(key interface{}) *contentNode {
+func (c *contentTreeReverseIndex) Get(key any) *contentNode {
c.init.Do(func() {
- c.m = make(map[interface{}]*contentNode)
+ c.m = make(map[any]*contentNode)
for _, tree := range c.t {
c.initFn(tree, c.m)
}
diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go
index e7661bb81..21a4e8f2a 100644
--- a/hugolib/content_map_page.go
+++ b/hugolib/content_map_page.go
@@ -66,7 +66,7 @@ func (m *pageMap) createMissingTaxonomyNodes() error {
if m.cfg.taxonomyDisabled {
return nil
}
- m.taxonomyEntries.Walk(func(s string, v interface{}) bool {
+ m.taxonomyEntries.Walk(func(s string, v any) bool {
n := v.(*contentNode)
vi := n.viewInfo
k := cleanSectionTreeKey(vi.name.plural + "/" + vi.termKey)
@@ -174,7 +174,7 @@ func (m *pageMap) newPageFromContentNode(n *contentNode, parentBucket *pagesMapB
return nil, err
}
- ps.init.Add(func() (interface{}, error) {
+ ps.init.Add(func() (any, error) {
pp, err := newPagePaths(s, ps, metaProvider)
if err != nil {
return nil, err
@@ -271,7 +271,7 @@ func (m *pageMap) newResource(fim hugofs.FileMetaInfo, owner *pageState) (resour
func (m *pageMap) createSiteTaxonomies() error {
m.s.taxonomies = make(TaxonomyList)
var walkErr error
- m.taxonomies.Walk(func(s string, v interface{}) bool {
+ m.taxonomies.Walk(func(s string, v any) bool {
n := v.(*contentNode)
t := n.viewInfo
@@ -285,7 +285,7 @@ func (m *pageMap) createSiteTaxonomies() error {
walkErr = errors.Errorf("missing taxonomy: %s", viewName.plural)
return true
}
- m.taxonomyEntries.WalkPrefix(s, func(ss string, v interface{}) bool {
+ m.taxonomyEntries.WalkPrefix(s, func(ss string, v any) bool {
b2 := v.(*contentNode)
info := b2.viewInfo
taxonomy.add(info.termKey, page.NewWeightedPage(info.weight, info.ref.p, n.p))
@@ -337,7 +337,7 @@ func (m *pageMap) assemblePages() error {
return err
}
- m.pages.Walk(func(s string, v interface{}) bool {
+ m.pages.Walk(func(s string, v any) bool {
n := v.(*contentNode)
var shouldBuild bool
@@ -397,7 +397,7 @@ func (m *pageMap) assemblePages() error {
func (m *pageMap) assembleResources(s string, p *pageState, parentBucket *pagesMapBucket) error {
var err error
- m.resources.WalkPrefix(s, func(s string, v interface{}) bool {
+ m.resources.WalkPrefix(s, func(s string, v any) bool {
n := v.(*contentNode)
meta := n.fi.Meta()
classifier := meta.Classifier
@@ -432,7 +432,7 @@ func (m *pageMap) assembleSections() error {
var sectionsToDelete []string
var err error
- m.sections.Walk(func(s string, v interface{}) bool {
+ m.sections.Walk(func(s string, v any) bool {
n := v.(*contentNode)
var shouldBuild bool
@@ -517,7 +517,7 @@ func (m *pageMap) assembleTaxonomies() error {
var taxonomiesToDelete []string
var err error
- m.taxonomies.Walk(func(s string, v interface{}) bool {
+ m.taxonomies.Walk(func(s string, v any) bool {
n := v.(*contentNode)
if n.p != nil {
@@ -861,7 +861,7 @@ func (b *pagesMapBucket) getTaxonomyEntries() page.Pages {
ref := b.owner.treeRef
viewInfo := ref.n.viewInfo
prefix := strings.ToLower("/" + viewInfo.name.plural + "/" + viewInfo.termKey + "/")
- ref.m.taxonomyEntries.WalkPrefix(prefix, func(s string, v interface{}) bool {
+ ref.m.taxonomyEntries.WalkPrefix(prefix, func(s string, v any) bool {
n := v.(*contentNode)
pas = append(pas, n.viewInfo.ref.p)
return false
@@ -967,7 +967,7 @@ func (w *sectionWalker) walkLevel(prefix string, createVisitor func() sectionWal
visitor := createVisitor()
- w.m.taxonomies.WalkBelow(prefix, func(s string, v interface{}) bool {
+ w.m.taxonomies.WalkBelow(prefix, func(s string, v any) bool {
currentLevel := strings.Count(s, "/")
if currentLevel > level+1 {
@@ -986,7 +986,7 @@ func (w *sectionWalker) walkLevel(prefix string, createVisitor func() sectionWal
return true
}
} else {
- w.m.taxonomyEntries.WalkPrefix(s, func(ss string, v interface{}) bool {
+ w.m.taxonomyEntries.WalkPrefix(s, func(ss string, v any) bool {
n := v.(*contentNode)
w.err = visitor.handlePage(ss, n)
return w.err != nil
@@ -998,7 +998,7 @@ func (w *sectionWalker) walkLevel(prefix string, createVisitor func() sectionWal
return w.err != nil
})
- w.m.sections.WalkBelow(prefix, func(s string, v interface{}) bool {
+ w.m.sections.WalkBelow(prefix, func(s string, v any) bool {
currentLevel := strings.Count(s, "/")
if currentLevel > level+1 {
return false
@@ -1010,7 +1010,7 @@ func (w *sectionWalker) walkLevel(prefix string, createVisitor func() sectionWal
return true
}
- w.m.pages.WalkPrefix(s+cmBranchSeparator, func(s string, v interface{}) bool {
+ w.m.pages.WalkPrefix(s+cmBranchSeparator, func(s string, v any) bool {
w.err = visitor.handlePage(s, v.(*contentNode))
return w.err != nil
})
diff --git a/hugolib/datafiles_test.go b/hugolib/datafiles_test.go
index f31024cf5..6cbe7bbc6 100644
--- a/hugolib/datafiles_test.go
+++ b/hugolib/datafiles_test.go
@@ -33,10 +33,10 @@ func TestDataDir(t *testing.T) {
equivDataDirs[0].addSource("data/test/a.json", `{ "b" : { "c1": "red" , "c2": "blue" } }`)
equivDataDirs[1].addSource("data/test/a.yaml", "b:\n c1: red\n c2: blue")
equivDataDirs[2].addSource("data/test/a.toml", "[b]\nc1 = \"red\"\nc2 = \"blue\"\n")
- expected := map[string]interface{}{
- "test": map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
+ expected := map[string]any{
+ "test": map[string]any{
+ "a": map[string]any{
+ "b": map[string]any{
"c1": "red",
"c2": "blue",
},
@@ -56,10 +56,10 @@ func TestDataDirNumeric(t *testing.T) {
equivDataDirs[0].addSource("data/test/a.json", `{ "b" : { "c1": 1.7 , "c2": 2.9 } }`)
equivDataDirs[1].addSource("data/test/a.yaml", "b:\n c1: 1.7\n c2: 2.9")
equivDataDirs[2].addSource("data/test/a.toml", "[b]\nc1 = 1.7\nc2 = 2.9\n")
- expected := map[string]interface{}{
- "test": map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
+ expected := map[string]any{
+ "test": map[string]any{
+ "a": map[string]any{
+ "b": map[string]any{
"c1": 1.7,
"c2": 2.9,
},
@@ -75,10 +75,10 @@ func TestDataDirBoolean(t *testing.T) {
equivDataDirs[0].addSource("data/test/a.json", `{ "b" : { "c1": true , "c2": false } }`)
equivDataDirs[1].addSource("data/test/a.yaml", "b:\n c1: true\n c2: false")
equivDataDirs[2].addSource("data/test/a.toml", "[b]\nc1 = true\nc2 = false\n")
- expected := map[string]interface{}{
- "test": map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
+ expected := map[string]any{
+ "test": map[string]any{
+ "a": map[string]any{
+ "b": map[string]any{
"c1": true,
"c2": false,
},
@@ -102,13 +102,13 @@ func TestDataDirTwoFiles(t *testing.T) {
equivDataDirs[2].addSource("data/test.toml", "hello = [\"world\", \"foo\"]")
expected :=
- map[string]interface{}{
- "test": map[string]interface{}{
- "hello": []interface{}{
+ map[string]any{
+ "test": map[string]any{
+ "hello": []any{
"world",
"foo",
},
- "foo": map[string]interface{}{
+ "foo": map[string]any{
"bar": "foofoo",
},
},
@@ -138,11 +138,11 @@ func TestDataDirOverriddenValue(t *testing.T) {
equivDataDirs[2].addSource("data/test.toml", "v1 = \"1\"")
expected :=
- map[string]interface{}{
- "a": map[string]interface{}{"a": "1"},
- "test": map[string]interface{}{
- "v1": map[string]interface{}{"v1-2": "2"},
- "v2": map[string]interface{}{"v2": []interface{}{"2", "3"}},
+ map[string]any{
+ "a": map[string]any{"a": "1"},
+ "test": map[string]any{
+ "v1": map[string]any{"v1-2": "2"},
+ "v2": map[string]any{"v2": []any{"2", "3"}},
},
}
@@ -162,11 +162,11 @@ func TestDataDirArrayAtTopLevelOfFile(t *testing.T) {
`)
expected :=
- map[string]interface{}{
- "test": []interface{}{
- map[string]interface{}{"hello": "world"},
- map[string]interface{}{"what": "time"},
- map[string]interface{}{"is": "lunch?"},
+ map[string]any{
+ "test": []any{
+ map[string]any{"hello": "world"},
+ map[string]any{"what": "time"},
+ map[string]any{"is": "lunch?"},
},
}
@@ -183,12 +183,12 @@ func TestDataDirMultipleSources(t *testing.T) {
dd.addSource("data/test/second.yaml", "tender: 2")
expected :=
- map[string]interface{}{
- "test": map[string]interface{}{
- "first": map[string]interface{}{
+ map[string]any{
+ "test": map[string]any{
+ "first": map[string]any{
"bar": 1,
},
- "second": map[string]interface{}{
+ "second": map[string]any{
"tender": 2,
},
},
@@ -213,14 +213,14 @@ func TestDataDirMultipleSourcesCommingled(t *testing.T) {
// 1. A theme uses the same key; the main data folder wins
// 2. A sub folder uses the same key: the sub folder wins
expected :=
- map[string]interface{}{
- "a": map[string]interface{}{
- "b1": map[string]interface{}{
+ map[string]any{
+ "a": map[string]any{
+ "b1": map[string]any{
"c1": "data/a/b1",
"c2": "mytheme/data/a/b1",
},
"b2": "data/a",
- "b3": []interface{}{"x", "y", "z"},
+ "b3": []any{"x", "y", "z"},
},
}
@@ -239,10 +239,10 @@ func TestDataDirCollidingChildArrays(t *testing.T) {
// 1. A theme uses the same key; the main data folder wins
// 2. A sub folder uses the same key: the sub folder wins
expected :=
- map[string]interface{}{
- "a": map[string]interface{}{
+ map[string]any{
+ "a": map[string]any{
"b1": "data/a",
- "b2": []interface{}{"1", "2", "3"},
+ "b2": []any{"1", "2", "3"},
},
}
@@ -257,9 +257,9 @@ func TestDataDirCollidingTopLevelArrays(t *testing.T) {
dd.addSource("data/a/b1.json", `["1", "2", "3"]`)
expected :=
- map[string]interface{}{
- "a": map[string]interface{}{
- "b1": []interface{}{"1", "2", "3"},
+ map[string]any{
+ "a": map[string]any{
+ "b1": []any{"1", "2", "3"},
},
}
@@ -277,11 +277,11 @@ func TestDataDirCollidingMapsAndArrays(t *testing.T) {
dd.addSource("data/b.json", `["x", "y", "z"]`)
expected :=
- map[string]interface{}{
- "a": map[string]interface{}{
+ map[string]any{
+ "a": map[string]any{
"music": "Queen's Rebuke",
},
- "b": []interface{}{"x", "y", "z"},
+ "b": []any{"x", "y", "z"},
}
doTestDataDir(t, dd, expected, "theme", "mytheme")
@@ -297,9 +297,9 @@ func TestDataDirNestedDirectories(t *testing.T) {
dd.addSource("data/test1/20/05/b.json", `{ "artist" : "Charlie Parker" }`)
expected :=
- map[string]interface{}{
- "a": []interface{}{"1", "2", "3"},
- "test1": map[string]interface{}{"20": map[string]interface{}{"05": map[string]interface{}{"b": map[string]interface{}{"artist": "Charlie Parker"}}, "06": map[string]interface{}{"a": map[string]interface{}{"artist": "Michael Brecker"}}}},
+ map[string]any{
+ "a": []any{"1", "2", "3"},
+ "test1": map[string]any{"20": map[string]any{"05": map[string]any{"b": map[string]any{"artist": "Charlie Parker"}}, "06": map[string]any{"a": map[string]any{"artist": "Michael Brecker"}}}},
}
doTestDataDir(t, dd, expected, "theme", "mytheme")
@@ -313,7 +313,7 @@ func (d *dataDir) addSource(path, content string) {
d.sources = append(d.sources, [2]string{path, content})
}
-func doTestEquivalentDataDirs(t *testing.T, equivDataDirs []dataDir, expected interface{}, configKeyValues ...interface{}) {
+func doTestEquivalentDataDirs(t *testing.T, equivDataDirs []dataDir, expected any, configKeyValues ...any) {
for i, dd := range equivDataDirs {
err := doTestDataDirImpl(t, dd, expected, configKeyValues...)
if err != "" {
@@ -322,14 +322,14 @@ func doTestEquivalentDataDirs(t *testing.T, equivDataDirs []dataDir, expected in
}
}
-func doTestDataDir(t *testing.T, dd dataDir, expected interface{}, configKeyValues ...interface{}) {
+func doTestDataDir(t *testing.T, dd dataDir, expected any, configKeyValues ...any) {
err := doTestDataDirImpl(t, dd, expected, configKeyValues...)
if err != "" {
t.Error(err)
}
}
-func doTestDataDirImpl(t *testing.T, dd dataDir, expected interface{}, configKeyValues ...interface{}) (err string) {
+func doTestDataDirImpl(t *testing.T, dd dataDir, expected any, configKeyValues ...any) (err string) {
cfg, fs := newTestCfg()
for i := 0; i < len(configKeyValues); i += 2 {
diff --git a/hugolib/embedded_shortcodes_test.go b/hugolib/embedded_shortcodes_test.go
index ba0abe43b..1707bcfa7 100644
--- a/hugolib/embedded_shortcodes_test.go
+++ b/hugolib/embedded_shortcodes_test.go
@@ -294,12 +294,12 @@ func TestShortcodeTweet(t *testing.T) {
t.Parallel()
for i, this := range []struct {
- privacy map[string]interface{}
+ privacy map[string]any
in, resp, expected string
}{
{
- map[string]interface{}{
- "twitter": map[string]interface{}{
+ map[string]any{
+ "twitter": map[string]any{
"simple": true,
},
},
@@ -308,8 +308,8 @@ func TestShortcodeTweet(t *testing.T) {
`.twitter-tweet a`,
},
{
- map[string]interface{}{
- "twitter": map[string]interface{}{
+ map[string]any{
+ "twitter": map[string]any{
"simple": false,
},
},
@@ -318,8 +318,8 @@ func TestShortcodeTweet(t *testing.T) {
`(?s)<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Hugo 0.15 will have 30%\+ faster render times thanks to this commit <a href="https://t.co/FfzhM8bNhT">https://t.co/FfzhM8bNhT</a> <a href="https://twitter.com/hashtag/gohugo\?src=hash&amp;ref_src=twsrc%5Etfw">#gohugo</a> <a href="https://twitter.com/hashtag/golang\?src=hash&amp;ref_src=twsrc%5Etfw">#golang</a> <a href="https://t.co/ITbMNU2BUf">https://t.co/ITbMNU2BUf</a></p>&mdash; Steve Francia \(@spf13\) <a href="https://twitter.com/spf13/status/666616452582129664\?ref_src=twsrc%5Etfw">November 17, 2015</a></blockquote>\s*<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`,
},
{
- map[string]interface{}{
- "twitter": map[string]interface{}{
+ map[string]any{
+ "twitter": map[string]any{
"simple": false,
},
},
@@ -330,8 +330,8 @@ func TestShortcodeTweet(t *testing.T) {
} {
// overload getJSON to return mock API response from Twitter
tweetFuncMap := template.FuncMap{
- "getJSON": func(urlParts ...interface{}) interface{} {
- var v interface{}
+ "getJSON": func(urlParts ...any) any {
+ var v any
err := json.Unmarshal([]byte(this.resp), &v)
if err != nil {
t.Fatalf("[%d] unexpected error in json.Unmarshal: %s", i, err)
@@ -382,13 +382,13 @@ func TestShortcodeInstagram(t *testing.T) {
} {
// overload getJSON to return mock API response from Instagram
instagramFuncMap := template.FuncMap{
- "getJSON": func(args ...interface{}) interface{} {
- headers := args[len(args)-1].(map[string]interface{})
+ "getJSON": func(args ...any) any {
+ headers := args[len(args)-1].(map[string]any)
auth := headers["Authorization"]
if auth != "Bearer dummytoken" {
return fmt.Errorf("invalid access token: %q", auth)
}
- var v interface{}
+ var v any
err := json.Unmarshal([]byte(this.resp), &v)
if err != nil {
return fmt.Errorf("[%d] unexpected error in json.Unmarshal: %s", i, err)
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go
index 7fbb53954..32d1eef71 100644
--- a/hugolib/filesystems/basefs_test.go
+++ b/hugolib/filesystems/basefs_test.go
@@ -314,12 +314,12 @@ func TestStaticFsMultiHost(t *testing.T) {
v.Set("theme", "t1")
v.Set("defaultContentLanguage", "en")
- langConfig := map[string]interface{}{
- "no": map[string]interface{}{
+ langConfig := map[string]any{
+ "no": map[string]any{
"staticDir": "static_no",
"baseURL": "https://example.org/no/",
},
- "en": map[string]interface{}{
+ "en": map[string]any{
"baseURL": "https://example.org/en/",
},
}
@@ -362,17 +362,17 @@ func TestMakePathRelative(t *testing.T) {
c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "static", "d2"), 0777), qt.IsNil)
c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "dust", "d2"), 0777), qt.IsNil)
- moduleCfg := map[string]interface{}{
- "mounts": []interface{}{
- map[string]interface{}{
+ moduleCfg := map[string]any{
+ "mounts": []any{
+ map[string]any{
"source": "dist",
"target": "static/mydist",
},
- map[string]interface{}{
+ map[string]any{
"source": "dust",
"target": "static/foo/bar",
},
- map[string]interface{}{
+ map[string]any{
"source": "static",
"target": "static",
},
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index 9d577a285..182d6bad1 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -79,7 +79,7 @@ type HugoSites struct {
codeownerInfo *codeownerInfo
// As loaded from the /data dirs
- data map[string]interface{}
+ data map[string]any
contentInit sync.Once
content *pageMaps
@@ -189,7 +189,7 @@ func (h *hugoSitesInit) Reset() {
h.translations.Reset()
}
-func (h *HugoSites) Data() map[string]interface{} {
+func (h *HugoSites) Data() map[string]any {
if _, err := h.init.data.Do(); err != nil {
h.SendError(errors.Wrap(err, "failed to load data"))
return nil
@@ -359,7 +359,7 @@ func newHugoSites(cfg deps.DepsCfg, sites ...*Site) (*HugoSites, error) {
donec: make(chan bool),
}
- h.init.data.Add(func() (interface{}, error) {
+ h.init.data.Add(func() (any, error) {
err := h.loadData(h.PathSpec.BaseFs.Data.Dirs)
if err != nil {
return nil, errors.Wrap(err, "failed to load data")
@@ -367,7 +367,7 @@ func newHugoSites(cfg deps.DepsCfg, sites ...*Site) (*HugoSites, error) {
return nil, nil
})
- h.init.layouts.Add(func() (interface{}, error) {
+ h.init.layouts.Add(func() (any, error) {
for _, s := range h.Sites {
if err := s.Tmpl().(tpl.TemplateManager).MarkReady(); err != nil {
return nil, err
@@ -376,7 +376,7 @@ func newHugoSites(cfg deps.DepsCfg, sites ...*Site) (*HugoSites, error) {
return nil, nil
})
- h.init.translations.Add(func() (interface{}, error) {
+ h.init.translations.Add(func() (any, error) {
if len(h.Sites) > 1 {
allTranslations := pagesToTranslationsMap(h.Sites)
assignTranslationsToPages(allTranslations, h.Sites)
@@ -385,7 +385,7 @@ func newHugoSites(cfg deps.DepsCfg, sites ...*Site) (*HugoSites, error) {
return nil, nil
})
- h.init.gitInfo.Add(func() (interface{}, error) {
+ h.init.gitInfo.Add(func() (any, error) {
err := h.loadGitInfo()
if err != nil {
return nil, errors.Wrap(err, "failed to load Git info")
@@ -857,7 +857,7 @@ func (h *HugoSites) Pages() page.Pages {
func (h *HugoSites) loadData(fis []hugofs.FileMetaInfo) (err error) {
spec := source.NewSourceSpec(h.PathSpec, nil, nil)
- h.data = make(map[string]interface{})
+ h.data = make(map[string]any)
for _, fi := range fis {
fileSystem := spec.NewFilesystemFromFileMetaInfo(fi)
files, err := fileSystem.Files()
@@ -875,7 +875,7 @@ func (h *HugoSites) loadData(fis []hugofs.FileMetaInfo) (err error) {
}
func (h *HugoSites) handleDataFile(r source.File) error {
- var current map[string]interface{}
+ var current map[string]any
f, err := r.FileInfo().Meta().Open()
if err != nil {
@@ -890,9 +890,9 @@ func (h *HugoSites) handleDataFile(r source.File) error {
for _, key := range keyParts {
if key != "" {
if _, ok := current[key]; !ok {
- current[key] = make(map[string]interface{})
+ current[key] = make(map[string]any)
}
- current = current[key].(map[string]interface{})
+ current = current[key].(map[string]any)
}
}
@@ -910,16 +910,16 @@ func (h *HugoSites) handleDataFile(r source.File) error {
switch data.(type) {
case nil:
- case map[string]interface{}:
+ case map[string]any:
switch higherPrecedentData.(type) {
case nil:
current[r.BaseFileName()] = data
- case map[string]interface{}:
+ case map[string]any:
// merge maps: insert entries from data for keys that
// don't already exist in higherPrecedentData
- higherPrecedentMap := higherPrecedentData.(map[string]interface{})
- for key, value := range data.(map[string]interface{}) {
+ higherPrecedentMap := higherPrecedentData.(map[string]any)
+ for key, value := range data.(map[string]any) {
if _, exists := higherPrecedentMap[key]; exists {
// this warning could happen if
// 1. A theme uses the same key; the main data folder wins
@@ -936,7 +936,7 @@ func (h *HugoSites) handleDataFile(r source.File) error {
"higher precedence %T data already in the data tree", data, r.Path(), higherPrecedentData)
}
- case []interface{}:
+ case []any:
if higherPrecedentData == nil {
current[r.BaseFileName()] = data
} else {
@@ -970,7 +970,7 @@ func (h *HugoSites) errWithFileContext(err error, f source.File) error {
return err
}
-func (h *HugoSites) readData(f source.File) (interface{}, error) {
+func (h *HugoSites) readData(f source.File) (any, error) {
file, err := f.FileInfo().Meta().Open()
if err != nil {
return nil, errors.Wrap(err, "readData: failed to open data file")
diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go
index 35804b89a..cdd7b8054 100644
--- a/hugolib/hugo_sites_build_test.go
+++ b/hugolib/hugo_sites_build_test.go
@@ -28,7 +28,7 @@ func TestMultiSitesMainLangInRoot(t *testing.T) {
func doTestMultiSitesMainLangInRoot(t *testing.T, defaultInSubDir bool) {
c := qt.New(t)
- siteConfig := map[string]interface{}{
+ siteConfig := map[string]any{
"DefaultContentLanguage": "fr",
"DefaultContentLanguageInSubdir": defaultInSubDir,
}
@@ -1235,7 +1235,7 @@ func writeNewContentFile(t *testing.T, fs afero.Fs, title, date, filename string
}
type multiSiteTestBuilder struct {
- configData interface{}
+ configData any
config string
configFormat string
@@ -1251,14 +1251,14 @@ func (b *multiSiteTestBuilder) WithNewConfig(config string) *multiSiteTestBuilde
return b
}
-func (b *multiSiteTestBuilder) WithNewConfigData(data interface{}) *multiSiteTestBuilder {
+func (b *multiSiteTestBuilder) WithNewConfigData(data any) *multiSiteTestBuilder {
b.WithConfigTemplate(data, b.configFormat, b.config)
return b
}
-func newMultiSiteTestBuilder(t testing.TB, configFormat, config string, configData interface{}) *multiSiteTestBuilder {
+func newMultiSiteTestBuilder(t testing.TB, configFormat, config string, configData any) *multiSiteTestBuilder {
if configData == nil {
- configData = map[string]interface{}{
+ configData = map[string]any{
"DefaultContentLanguage": "fr",
"DefaultContentLanguageInSubdir": true,
}
diff --git a/hugolib/image_test.go b/hugolib/image_test.go
index 4726f5b49..5f056e4ad 100644
--- a/hugolib/image_test.go
+++ b/hugolib/image_test.go
@@ -37,7 +37,7 @@ func TestImageOps(t *testing.T) {
c.Assert(err, qt.IsNil)
defer clean()
- newBuilder := func(timeout interface{}) *sitesBuilder {
+ newBuilder := func(timeout any) *sitesBuilder {
v := config.New()
v.Set("workingDir", workDir)
v.Set("baseURL", "https://example.org")
diff --git a/hugolib/language_content_dir_test.go b/hugolib/language_content_dir_test.go
index 9a7a78e7e..682531566 100644
--- a/hugolib/language_content_dir_test.go
+++ b/hugolib/language_content_dir_test.go
@@ -251,7 +251,7 @@ Content.
c.Assert(contentStr, qt.Contains, "SVP3-RELREF: /sv/sect/p-sv-3/")
// Test RelRef with and without language indicator.
- nn3RefArgs := map[string]interface{}{
+ nn3RefArgs := map[string]any{
"path": "/sect/page3.md",
"lang": "nn",
}
diff --git a/hugolib/page.go b/hugolib/page.go
index c4f30de9d..2fddaa299 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -79,7 +79,7 @@ type pageContext interface {
}
// wrapErr adds some context to the given error if possible.
-func wrapErr(err error, ctx interface{}) error {
+func wrapErr(err error, ctx any) error {
if pc, ok := ctx.(pageContext); ok {
return pc.wrapError(err)
}
@@ -139,7 +139,7 @@ func (p *pageState) Err() error {
// Eq returns whether the current page equals the given page.
// This is what's invoked when doing `{{ if eq $page $otherPage }}`
-func (p *pageState) Eq(other interface{}) bool {
+func (p *pageState) Eq(other any) bool {
pp, err := unwrapPage(other)
if err != nil {
return false
@@ -600,7 +600,7 @@ func (p *pageState) mapContent(bucket *pagesMapBucket, meta *pageMeta) error {
s := p.shortcodeState
rn := &pageContentMap{
- items: make([]interface{}, 0, 20),
+ items: make([]any, 0, 20),
}
iter := p.source.parsed.Iterator()
@@ -737,12 +737,12 @@ Loop:
return nil
}
-func (p *pageState) errorf(err error, format string, a ...interface{}) error {
+func (p *pageState) errorf(err error, format string, a ...any) error {
if herrors.UnwrapErrorWithFileContext(err) != nil {
// More isn't always better.
return err
}
- args := append([]interface{}{p.Language().Lang, p.pathOrTitle()}, a...)
+ args := append([]any{p.Language().Lang, p.pathOrTitle()}, a...)
format = "[%s] page %q: " + format
if err == nil {
errors.Errorf(format, args...)
diff --git a/hugolib/page__content.go b/hugolib/page__content.go
index c08ac67af..52389c472 100644
--- a/hugolib/page__content.go
+++ b/hugolib/page__content.go
@@ -111,7 +111,7 @@ type pageContentMap struct {
hasNonMarkdownShortcode bool
// *shortcode, pageContentReplacement or pageparser.Item
- items []interface{}
+ items []any
}
func (p *pageContentMap) AddBytes(item pageparser.Item) {
diff --git a/hugolib/page__data.go b/hugolib/page__data.go
index 7ab668503..19b0154ad 100644
--- a/hugolib/page__data.go
+++ b/hugolib/page__data.go
@@ -26,7 +26,7 @@ type pageData struct {
data page.Data
}
-func (p *pageData) Data() interface{} {
+func (p *pageData) Data() any {
p.dataInit.Do(func() {
p.data = make(page.Data)
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go
index dcbf1a606..5568aa539 100644
--- a/hugolib/page__meta.go
+++ b/hugolib/page__meta.go
@@ -70,7 +70,7 @@ type pageMeta struct {
bundleType files.ContentClass
// Params contains configuration defined in the params section of page frontmatter.
- params map[string]interface{}
+ params map[string]any
title string
linkTitle string
@@ -110,7 +110,7 @@ type pageMeta struct {
// This is the raw front matter metadata that is going to be assigned to
// the Resources above.
- resourcesMetadata []map[string]interface{}
+ resourcesMetadata []map[string]any
f source.File
@@ -121,7 +121,7 @@ type pageMeta struct {
s *Site
- renderingConfigOverrides map[string]interface{}
+ renderingConfigOverrides map[string]any
contentConverterInit sync.Once
contentConverter converter.Converter
}
@@ -223,7 +223,7 @@ func (p *pageMeta) IsPage() bool {
//
// This method is also implemented on SiteInfo.
// TODO(bep) interface
-func (p *pageMeta) Param(key interface{}) (interface{}, error) {
+func (p *pageMeta) Param(key any) (any, error) {
return resource.Param(p, p.s.Info.Params(), key)
}
@@ -347,7 +347,7 @@ func (pm *pageMeta) mergeBucketCascades(b1, b2 *pagesMapBucket) {
}
}
-func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, frontmatter map[string]interface{}) error {
+func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, frontmatter map[string]any) error {
pm.params = make(maps.Params)
if frontmatter == nil && (parentBucket == nil || parentBucket.cascade == nil) {
@@ -368,7 +368,7 @@ func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, fron
}
}
} else {
- frontmatter = make(map[string]interface{})
+ frontmatter = make(map[string]any)
}
var cascade map[page.PageMatcher]maps.Params
@@ -546,22 +546,22 @@ func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, fron
pm.translationKey = cast.ToString(v)
pm.params[loki] = pm.translationKey
case "resources":
- var resources []map[string]interface{}
+ var resources []map[string]any
handled := true
switch vv := v.(type) {
- case []map[interface{}]interface{}:
+ case []map[any]any:
for _, vvv := range vv {
resources = append(resources, maps.ToStringMap(vvv))
}
- case []map[string]interface{}:
+ case []map[string]any:
resources = append(resources, vv...)
- case []interface{}:
+ case []any:
for _, vvv := range vv {
switch vvvv := vvv.(type) {
- case map[interface{}]interface{}:
+ case map[any]any:
resources = append(resources, maps.ToStringMap(vvvv))
- case map[string]interface{}:
+ case map[string]any:
resources = append(resources, vvvv)
}
}
@@ -591,14 +591,14 @@ func (pm *pageMeta) setMetadata(parentBucket *pagesMapBucket, p *pageState, fron
pm.params[loki] = vv
default: // handle array of strings as well
switch vvv := vv.(type) {
- case []interface{}:
+ case []any:
if len(vvv) > 0 {
switch vvv[0].(type) {
- case map[interface{}]interface{}: // Proper parsing structured array from YAML based FrontMatter
+ case map[any]any:
pm.params[loki] = vvv
- case map[string]interface{}: // Proper parsing structured array from JSON based FrontMatter
+ case map[string]any:
pm.params[loki] = vvv
- case []interface{}:
+ case []any:
pm.params[loki] = vvv
default:
a := make([]string, len(vvv))
@@ -744,7 +744,7 @@ func (p *pageMeta) applyDefaultValues(n *contentNode) error {
}
if !p.f.IsZero() {
- var renderingConfigOverrides map[string]interface{}
+ var renderingConfigOverrides map[string]any
bfParam := getParamToLower(p, "blackfriday")
if bfParam != nil {
renderingConfigOverrides = maps.ToStringMap(bfParam)
@@ -757,7 +757,7 @@ func (p *pageMeta) applyDefaultValues(n *contentNode) error {
return nil
}
-func (p *pageMeta) newContentConverter(ps *pageState, markup string, renderingConfigOverrides map[string]interface{}) (converter.Converter, error) {
+func (p *pageMeta) newContentConverter(ps *pageState, markup string, renderingConfigOverrides map[string]any) (converter.Converter, error) {
if ps == nil {
panic("no Page provided")
}
@@ -806,7 +806,7 @@ func (p *pageMeta) Slug() string {
return p.urlPaths.Slug
}
-func getParam(m resource.ResourceParamsProvider, key string, stringToLower bool) interface{} {
+func getParam(m resource.ResourceParamsProvider, key string, stringToLower bool) any {
v := m.Params()[strings.ToLower(key)]
if v == nil {
@@ -837,6 +837,6 @@ func getParam(m resource.ResourceParamsProvider, key string, stringToLower bool)
}
}
-func getParamToLower(m resource.ResourceParamsProvider, key string) interface{} {
+func getParamToLower(m resource.ResourceParamsProvider, key string) any {
return getParam(m, key, true)
}
diff --git a/hugolib/page__new.go b/hugolib/page__new.go
index b8395d5ca..897c0281b 100644
--- a/hugolib/page__new.go
+++ b/hugolib/page__new.go
@@ -92,7 +92,7 @@ func newPageBucket(p *pageState) *pagesMapBucket {
func newPageFromMeta(
n *contentNode,
parentBucket *pagesMapBucket,
- meta map[string]interface{},
+ meta map[string]any,
metaProvider *pageMeta) (*pageState, error) {
if metaProvider.f == nil {
metaProvider.f = page.NewZeroFile(metaProvider.s.LogDistinct)
@@ -119,7 +119,7 @@ func newPageFromMeta(
return nil, err
}
- ps.init.Add(func() (interface{}, error) {
+ ps.init.Add(func() (any, error) {
pp, err := newPagePaths(metaProvider.s, ps, metaProvider)
if err != nil {
return nil, err
@@ -189,7 +189,7 @@ type pageDeprecatedWarning struct {
func (p *pageDeprecatedWarning) IsDraft() bool { return p.p.m.draft }
func (p *pageDeprecatedWarning) Hugo() hugo.Info { return p.p.s.Info.Hugo() }
func (p *pageDeprecatedWarning) LanguagePrefix() string { return p.p.s.Info.LanguagePrefix }
-func (p *pageDeprecatedWarning) GetParam(key string) interface{} {
+func (p *pageDeprecatedWarning) GetParam(key string) any {
return p.p.m.params[strings.ToLower(key)]
}
diff --git a/hugolib/page__paginator.go b/hugolib/page__paginator.go
index a5a3f07a6..709f0e9ea 100644
--- a/hugolib/page__paginator.go
+++ b/hugolib/page__paginator.go
@@ -41,7 +41,7 @@ func (p *pagePaginator) reset() {
p.pagePaginatorInit = &pagePaginatorInit{}
}
-func (p *pagePaginator) Paginate(seq interface{}, options ...interface{}) (*page.Pager, error) {
+func (p *pagePaginator) Paginate(seq any, options ...any) (*page.Pager, error) {
var initErr error
p.init.Do(func() {
pagerSize, err := page.ResolvePagerSize(p.source.s.Cfg, options...)
@@ -68,7 +68,7 @@ func (p *pagePaginator) Paginate(seq interface{}, options ...interface{}) (*page
return p.current, nil
}
-func (p *pagePaginator) Paginator(options ...interface{}) (*page.Pager, error) {
+func (p *pagePaginator) Paginator(options ...any) (*page.Pager, error) {
var initErr error
p.init.Do(func() {
pagerSize, err := page.ResolvePagerSize(p.source.s.Cfg, options...)
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index a7ad2a245..c77d7c32e 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -195,11 +195,11 @@ func newPageContentOutput(p *pageState, po *pageOutput) (*pageContentOutput, err
}
// There may be recursive loops in shortcodes and render hooks.
- cp.initMain = parent.BranchWithTimeout(p.s.siteCfg.timeout, func(ctx context.Context) (interface{}, error) {
+ cp.initMain = parent.BranchWithTimeout(p.s.siteCfg.timeout, func(ctx context.Context) (any, error) {
return nil, initContent()
})
- cp.initPlain = cp.initMain.Branch(func() (interface{}, error) {
+ cp.initPlain = cp.initMain.Branch(func() (any, error) {
cp.plain = helpers.StripHTML(string(cp.content))
cp.plainWords = strings.Fields(cp.plain)
cp.setWordCounts(p.m.isCJKLanguage)
@@ -272,7 +272,7 @@ func (p *pageContentOutput) Reset() {
p.renderHooks = &renderHooks{}
}
-func (p *pageContentOutput) Content() (interface{}, error) {
+func (p *pageContentOutput) Content() (any, error) {
if p.p.s.initInit(p.initMain, p.p) {
return p.content, nil
}
@@ -330,7 +330,7 @@ func (p *pageContentOutput) WordCount() int {
return p.wordCount
}
-func (p *pageContentOutput) RenderString(args ...interface{}) (template.HTML, error) {
+func (p *pageContentOutput) RenderString(args ...any) (template.HTML, error) {
if len(args) < 1 || len(args) > 2 {
return "", errors.New("want 1 or 2 arguments")
}
@@ -342,7 +342,7 @@ func (p *pageContentOutput) RenderString(args ...interface{}) (template.HTML, er
if len(args) == 1 {
sidx = 0
} else {
- m, ok := args[0].(map[string]interface{})
+ m, ok := args[0].(map[string]any)
if !ok {
return "", errors.New("first argument must be a map")
}
@@ -433,14 +433,14 @@ func (p *pageContentOutput) initRenderHooks() error {
type cacheKey struct {
tp hooks.RendererType
- id interface{}
+ id any
f output.Format
}
- renderCache := make(map[cacheKey]interface{})
+ renderCache := make(map[cacheKey]any)
var renderCacheMu sync.Mutex
- resolvePosition := func(ctx interface{}) text.Position {
+ resolvePosition := func(ctx any) text.Position {
var offset int
switch v := ctx.(type) {
@@ -459,7 +459,7 @@ func (p *pageContentOutput) initRenderHooks() error {
return pos
}
- p.renderHooks.getRenderer = func(tp hooks.RendererType, id interface{}) interface{} {
+ p.renderHooks.getRenderer = func(tp hooks.RendererType, id any) any {
renderCacheMu.Lock()
defer renderCacheMu.Unlock()
@@ -650,7 +650,7 @@ func (t targetPathsHolder) targetPaths() page.TargetPaths {
return t.paths
}
-func executeToString(h tpl.TemplateHandler, templ tpl.Template, data interface{}) (string, error) {
+func executeToString(h tpl.TemplateHandler, templ tpl.Template, data any) (string, error) {
b := bp.GetBuffer()
defer bp.PutBuffer(b)
if err := h.Execute(templ, b, data); err != nil {
diff --git a/hugolib/page__ref.go b/hugolib/page__ref.go
index f2b819c57..242317973 100644
--- a/hugolib/page__ref.go
+++ b/hugolib/page__ref.go
@@ -30,23 +30,23 @@ type pageRef struct {
p *pageState
}
-func (p pageRef) Ref(argsm map[string]interface{}) (string, error) {
+func (p pageRef) Ref(argsm map[string]any) (string, error) {
return p.ref(argsm, p.p)
}
-func (p pageRef) RefFrom(argsm map[string]interface{}, source interface{}) (string, error) {
+func (p pageRef) RefFrom(argsm map[string]any, source any) (string, error) {
return p.ref(argsm, source)
}
-func (p pageRef) RelRef(argsm map[string]interface{}) (string, error) {
+func (p pageRef) RelRef(argsm map[string]any) (string, error) {
return p.relRef(argsm, p.p)
}
-func (p pageRef) RelRefFrom(argsm map[string]interface{}, source interface{}) (string, error) {
+func (p pageRef) RelRefFrom(argsm map[string]any, source any) (string, error) {
return p.relRef(argsm, source)
}
-func (p pageRef) decodeRefArgs(args map[string]interface{}) (refArgs, *Site, error) {
+func (p pageRef) decodeRefArgs(args map[string]any) (refArgs, *Site, error) {
var ra refArgs
err := mapstructure.WeakDecode(args, &ra)
if err != nil {
@@ -74,7 +74,7 @@ func (p pageRef) decodeRefArgs(args map[string]interface{}) (refArgs, *Site, err
return ra, s, nil
}
-func (p pageRef) ref(argsm map[string]interface{}, source interface{}) (string, error) {
+func (p pageRef) ref(argsm map[string]any, source any) (string, error) {
args, s, err := p.decodeRefArgs(argsm)
if err != nil {
return "", errors.Wrap(err, "invalid arguments to Ref")
@@ -91,7 +91,7 @@ func (p pageRef) ref(argsm map[string]interface{}, source interface{}) (string,
return s.refLink(args.Path, source, false, args.OutputFormat)
}
-func (p pageRef) relRef(argsm map[string]interface{}, source interface{}) (string, error) {
+func (p pageRef) relRef(argsm map[string]any, source any) (string, error) {
args, s, err := p.decodeRefArgs(argsm)
if err != nil {
return "", errors.Wrap(err, "invalid arguments to Ref")
diff --git a/hugolib/page__tree.go b/hugolib/page__tree.go
index e4f3c6b51..d2b1f684a 100644
--- a/hugolib/page__tree.go
+++ b/hugolib/page__tree.go
@@ -25,7 +25,7 @@ type pageTree struct {
p *pageState
}
-func (pt pageTree) IsAncestor(other interface{}) (bool, error) {
+func (pt pageTree) IsAncestor(other any) (bool, error) {
if pt.p == nil {
return false, nil
}
@@ -71,7 +71,7 @@ func (pt pageTree) CurrentSection() page.Page {
return p.Parent()
}
-func (pt pageTree) IsDescendant(other interface{}) (bool, error) {
+func (pt pageTree) IsDescendant(other any) (bool, error) {
if pt.p == nil {
return false, nil
}
@@ -125,7 +125,7 @@ func (pt pageTree) FirstSection() page.Page {
return b.p
}
-func (pt pageTree) InSection(other interface{}) (bool, error) {
+func (pt pageTree) InSection(other any) (bool, error) {
if pt.p == nil || types.IsNil(other) {
return false, nil
}
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 926fdb354..d29a4f865 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -298,7 +298,7 @@ func checkPageTitle(t *testing.T, page page.Page, title string) {
}
}
-func checkPageContent(t *testing.T, page page.Page, expected string, msg ...interface{}) {
+func checkPageContent(t *testing.T, page page.Page, expected string, msg ...any) {
t.Helper()
a := normalizeContent(expected)
b := normalizeContent(content(page))
@@ -325,7 +325,7 @@ func checkPageTOC(t *testing.T, page page.Page, toc string) {
}
}
-func checkPageSummary(t *testing.T, page page.Page, summary string, msg ...interface{}) {
+func checkPageSummary(t *testing.T, page page.Page, summary string, msg ...any) {
a := normalizeContent(string(page.Summary()))
b := normalizeContent(summary)
if a != b {
@@ -369,7 +369,7 @@ func normalizeExpected(ext, str string) string {
}
func testAllMarkdownEnginesForPages(t *testing.T,
- assertFunc func(t *testing.T, ext string, pages page.Pages), settings map[string]interface{}, pageSources ...string) {
+ assertFunc func(t *testing.T, ext string, pages page.Pages), settings map[string]any, pageSources ...string) {
engines := []struct {
ext string
@@ -399,8 +399,8 @@ func testAllMarkdownEnginesForPages(t *testing.T,
contentDir = s
}
- cfg.Set("security", map[string]interface{}{
- "exec": map[string]interface{}{
+ cfg.Set("security", map[string]any{
+ "exec": map[string]any{
"allow": []string{"^python$", "^rst2html.*", "^asciidoctor$"},
},
})
@@ -572,7 +572,7 @@ func TestCreateNewPage(t *testing.T) {
checkPageType(t, p, "page")
}
- settings := map[string]interface{}{
+ settings := map[string]any{
"contentDir": "mycontent",
}
@@ -697,7 +697,7 @@ func TestPageWithShortCodeInSummary(t *testing.T) {
func TestPageWithAdditionalExtension(t *testing.T) {
t.Parallel()
cfg, fs := newTestCfg()
- cfg.Set("markup", map[string]interface{}{
+ cfg.Set("markup", map[string]any{
"defaultMarkdownHandler": "blackfriday", // TODO(bep)
})
@@ -1039,18 +1039,18 @@ func TestPageWithLastmodFromGitInfo(t *testing.T) {
wd, err := os.Getwd()
c.Assert(err, qt.IsNil)
- cfg.Set("frontmatter", map[string]interface{}{
+ cfg.Set("frontmatter", map[string]any{
"lastmod": []string{":git", "lastmod"},
})
cfg.Set("defaultContentLanguage", "en")
- langConfig := map[string]interface{}{
- "en": map[string]interface{}{
+ langConfig := map[string]any{
+ "en": map[string]any{
"weight": 1,
"languageName": "English",
"contentDir": "content",
},
- "nn": map[string]interface{}{
+ "nn": map[string]any{
"weight": 2,
"languageName": "Nynorsk",
"contentDir": "content_nn",
@@ -1102,7 +1102,7 @@ lastMod: 2018-02-28
Content
`
- cfg.Set("frontmatter", map[string]interface{}{
+ cfg.Set("frontmatter", map[string]any{
"date": []string{dateHandler, "date"},
})
@@ -1163,7 +1163,7 @@ func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) {
t.Parallel()
- settings := map[string]interface{}{"hasCJKLanguage": true}
+ settings := map[string]any{"hasCJKLanguage": true}
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
@@ -1176,7 +1176,7 @@ func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) {
func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
t.Parallel()
- settings := map[string]interface{}{"hasCJKLanguage": true}
+ settings := map[string]any{"hasCJKLanguage": true}
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
@@ -1195,7 +1195,7 @@ func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
func TestWordCountWithIsCJKLanguageFalse(t *testing.T) {
t.Parallel()
- settings := map[string]interface{}{
+ settings := map[string]any{
"hasCJKLanguage": true,
}
diff --git a/hugolib/page_unwrap.go b/hugolib/page_unwrap.go
index eda6636d1..0e985953b 100644
--- a/hugolib/page_unwrap.go
+++ b/hugolib/page_unwrap.go
@@ -25,7 +25,7 @@ type pageWrapper interface {
}
// unwrapPage is used in equality checks and similar.
-func unwrapPage(in interface{}) (page.Page, error) {
+func unwrapPage(in any) (page.Page, error) {
switch v := in.(type) {
case *pageState:
return v, nil
@@ -40,7 +40,7 @@ func unwrapPage(in interface{}) (page.Page, error) {
}
}
-func mustUnwrapPage(in interface{}) page.Page {
+func mustUnwrapPage(in any) page.Page {
p, err := unwrapPage(in)
if err != nil {
panic(err)
diff --git a/hugolib/page_unwrap_test.go b/hugolib/page_unwrap_test.go
index bcc1b769a..2d9b5e17f 100644
--- a/hugolib/page_unwrap_test.go
+++ b/hugolib/page_unwrap_test.go
@@ -29,7 +29,7 @@ func TestUnwrapPage(t *testing.T) {
c.Assert(mustUnwrap(newPageForRenderHook(p)), qt.Equals, p)
}
-func mustUnwrap(v interface{}) page.Page {
+func mustUnwrap(v any) page.Page {
p, err := unwrapPage(v)
if err != nil {
panic(err)
diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go
index 238c725bd..d7a83d79d 100644
--- a/hugolib/pagebundler_test.go
+++ b/hugolib/pagebundler_test.go
@@ -73,8 +73,8 @@ func TestPageBundlerSiteRegular(t *testing.T) {
"/": ":filename/",
})
- cfg.Set("outputFormats", map[string]interface{}{
- "CUSTOMO": map[string]interface{}{
+ cfg.Set("outputFormats", map[string]any{
+ "CUSTOMO": map[string]any{
"mediaType": "text/html",
"baseName": "cindex",
"path": "cpath",
@@ -82,7 +82,7 @@ func TestPageBundlerSiteRegular(t *testing.T) {
},
})
- cfg.Set("outputs", map[string]interface{}{
+ cfg.Set("outputs", map[string]any{
"home": []string{"HTML", "CUSTOMO"},
"page": []string{"HTML", "CUSTOMO"},
"section": []string{"HTML", "CUSTOMO"},
@@ -705,8 +705,8 @@ func newTestBundleSources(t testing.TB) (*hugofs.Fs, config.Provider) {
cfg.Set("workingDir", workDir)
cfg.Set("contentDir", "base")
cfg.Set("baseURL", "https://example.com")
- cfg.Set("mediaTypes", map[string]interface{}{
- "bepsays/bep": map[string]interface{}{
+ cfg.Set("mediaTypes", map[string]any{
+ "bepsays/bep": map[string]any{
"suffixes": []string{"bep"},
},
})
@@ -873,12 +873,12 @@ func newTestBundleSourcesMultilingual(t *testing.T) (*hugofs.Fs, config.Provider
cfg.Set("baseURL", "https://example.com")
cfg.Set("defaultContentLanguage", "en")
- langConfig := map[string]interface{}{
- "en": map[string]interface{}{
+ langConfig := map[string]any{
+ "en": map[string]any{
"weight": 1,
"languageName": "English",
},
- "nn": map[string]interface{}{
+ "nn": map[string]any{
"weight": 2,
"languageName": "Nynorsk",
},
diff --git a/hugolib/pages_capture_test.go b/hugolib/pages_capture_test.go
index 4b2979a0a..ea2ef4e1e 100644
--- a/hugolib/pages_capture_test.go
+++ b/hugolib/pages_capture_test.go
@@ -63,11 +63,11 @@ func TestPagesCapture(t *testing.T) {
}
type testPagesCollectorProcessor struct {
- items []interface{}
+ items []any
waitErr error
}
-func (proc *testPagesCollectorProcessor) Process(item interface{}) error {
+func (proc *testPagesCollectorProcessor) Process(item any) error {
proc.items = append(proc.items, item)
return nil
}
diff --git a/hugolib/pages_language_merge_test.go b/hugolib/pages_language_merge_test.go
index 9c22d2e70..628abe8aa 100644
--- a/hugolib/pages_language_merge_test.go
+++ b/hugolib/pages_language_merge_test.go
@@ -76,7 +76,7 @@ func TestMergeLanguages(t *testing.T) {
c.Assert(len(enBundle.Resources()), qt.Equals, 6)
c.Assert(len(nnBundle.Resources()), qt.Equals, 2)
- var ri interface{} = nnBundle.Resources()
+ var ri any = nnBundle.Resources()
// This looks less ugly in the templates ...
mergedNNResources := ri.(resource.ResourcesLanguageMerger).MergeByLanguage(enBundle.Resources())
diff --git a/hugolib/pages_process.go b/hugolib/pages_process.go
index 541c0ae3e..d33f70d8e 100644
--- a/hugolib/pages_process.go
+++ b/hugolib/pages_process.go
@@ -35,7 +35,7 @@ func newPagesProcessor(h *HugoSites, sp *source.SourceSpec) *pagesProcessor {
procs[s.Lang()] = &sitePagesProcessor{
m: s.pageMap,
errorSender: s.h,
- itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
+ itemChan: make(chan any, config.GetNumWorkerMultiplier()*2),
}
}
return &pagesProcessor{
@@ -44,7 +44,7 @@ func newPagesProcessor(h *HugoSites, sp *source.SourceSpec) *pagesProcessor {
}
type pagesCollectorProcessorProvider interface {
- Process(item interface{}) error
+ Process(item any) error
Start(ctx context.Context) context.Context
Wait() error
}
@@ -54,7 +54,7 @@ type pagesProcessor struct {
procs map[string]pagesCollectorProcessorProvider
}
-func (proc *pagesProcessor) Process(item interface{}) error {
+func (proc *pagesProcessor) Process(item any) error {
switch v := item.(type) {
// Page bundles mapped to their language.
case pageBundles:
@@ -97,7 +97,7 @@ func (proc *pagesProcessor) getProcFromFi(fi hugofs.FileMetaInfo) pagesCollector
type nopPageProcessor int
-func (nopPageProcessor) Process(item interface{}) error {
+func (nopPageProcessor) Process(item any) error {
return nil
}
@@ -116,11 +116,11 @@ type sitePagesProcessor struct {
errorSender herrors.ErrorSender
ctx context.Context
- itemChan chan interface{}
+ itemChan chan any
itemGroup *errgroup.Group
}
-func (p *sitePagesProcessor) Process(item interface{}) error {
+func (p *sitePagesProcessor) Process(item any) error {
select {
case <-p.ctx.Done():
return nil
@@ -165,7 +165,7 @@ func (p *sitePagesProcessor) copyFile(fim hugofs.FileMetaInfo) error {
return s.publish(&s.PathSpec.ProcessingStats.Files, target, f)
}
-func (p *sitePagesProcessor) doProcess(item interface{}) error {
+func (p *sitePagesProcessor) doProcess(item any) error {
m := p.m
switch v := item.(type) {
case *fileinfoBundle:
diff --git a/hugolib/paths/paths_test.go b/hugolib/paths/paths_test.go
index d3ead4d17..4e68acafb 100644
--- a/hugolib/paths/paths_test.go
+++ b/hugolib/paths/paths_test.go
@@ -28,9 +28,9 @@ func TestNewPaths(t *testing.T) {
v := config.New()
fs := hugofs.NewMem(v)
- v.Set("languages", map[string]interface{}{
- "no": map[string]interface{}{},
- "en": map[string]interface{}{},
+ v.Set("languages", map[string]any{
+ "no": map[string]any{},
+ "en": map[string]any{},
})
v.Set("defaultContentLanguageInSubdir", true)
v.Set("defaultContentLanguage", "no")
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index f2e3f6cdf..cc8f55119 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -107,7 +107,7 @@ PRINT PROTOCOL ERROR1: error calling resources.GetRemote: Get "gopher://example.
PRINT PROTOCOL ERROR2: error calling resources.GetRemote: Get "gopher://example.org": unsupported protocol scheme "gopher"
-`, helpers.HashString(ts.URL+"/sunset.jpg", map[string]interface{}{})))
+`, helpers.HashString(ts.URL+"/sunset.jpg", map[string]any{})))
b.AssertFileContent("public/styles.min.a1df58687c3c9cc38bf26532f7b4b2f2c2b0315dcde212376959995c04f11fef.css", "body{background-color:#add8e6}")
b.AssertFileContent("public//styles2.min.1cfc52986836405d37f9998a63fd6dd8608e8c410e5e3db1daaa30f78bc273ba.css", "body{background-color:orange}")
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index ec3a4a01b..ac9e4a699 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -50,7 +50,7 @@ var (
// ShortcodeWithPage is the "." context in a shortcode template.
type ShortcodeWithPage struct {
- Params interface{}
+ Params any
Inner template.HTML
Page page.Page
Parent *ShortcodeWithPage
@@ -87,13 +87,13 @@ func (scp *ShortcodeWithPage) Site() page.Site {
// Ref is a shortcut to the Ref method on Page. It passes itself as a context
// to get better error messages.
-func (scp *ShortcodeWithPage) Ref(args map[string]interface{}) (string, error) {
+func (scp *ShortcodeWithPage) Ref(args map[string]any) (string, error) {
return scp.Page.RefFrom(args, scp)
}
// RelRef is a shortcut to the RelRef method on Page. It passes itself as a context
// to get better error messages.
-func (scp *ShortcodeWithPage) RelRef(args map[string]interface{}) (string, error) {
+func (scp *ShortcodeWithPage) RelRef(args map[string]any) (string, error) {
return scp.Page.RelRefFrom(args, scp)
}
@@ -107,7 +107,7 @@ func (scp *ShortcodeWithPage) Scratch() *maps.Scratch {
}
// Get is a convenience method to look up shortcode parameters by its key.
-func (scp *ShortcodeWithPage) Get(key interface{}) interface{} {
+func (scp *ShortcodeWithPage) Get(key any) any {
if scp.Params == nil {
return nil
}
@@ -162,10 +162,10 @@ func createShortcodePlaceholder(id string, ordinal int) string {
type shortcode struct {
name string
- isInline bool // inline shortcode. Any inner will be a Go template.
- isClosing bool // whether a closing tag was provided
- inner []interface{} // string or nested shortcode
- params interface{} // map or array
+ isInline bool // inline shortcode. Any inner will be a Go template.
+ isClosing bool // whether a closing tag was provided
+ inner []any // string or nested shortcode
+ params any // map or array
ordinal int
err error
@@ -214,16 +214,16 @@ func (s shortcode) innerString() string {
func (sc shortcode) String() string {
// for testing (mostly), so any change here will break tests!
- var params interface{}
+ var params any
switch v := sc.params.(type) {
- case map[string]interface{}:
+ case map[string]any:
// sort the keys so test assertions won't fail
var keys []string
for k := range v {
keys = append(keys, k)
}
sort.Strings(keys)
- tmp := make(map[string]interface{})
+ tmp := make(map[string]any)
for _, k := range keys {
tmp[k] = v[k]
@@ -552,11 +552,11 @@ Loop:
} else if pt.Peek().IsShortcodeParamVal() {
// named params
if sc.params == nil {
- params := make(map[string]interface{})
+ params := make(map[string]any)
params[currItem.ValStr()] = pt.Next().ValTyped()
sc.params = params
} else {
- if params, ok := sc.params.(map[string]interface{}); ok {
+ if params, ok := sc.params.(map[string]any); ok {
params[currItem.ValStr()] = pt.Next().ValTyped()
} else {
return sc, errShortCodeIllegalState
@@ -565,11 +565,11 @@ Loop:
} else {
// positional params
if sc.params == nil {
- var params []interface{}
+ var params []any
params = append(params, currItem.ValTyped())
sc.params = params
} else {
- if params, ok := sc.params.([]interface{}); ok {
+ if params, ok := sc.params.([]any); ok {
params = append(params, currItem.ValTyped())
sc.params = params
} else {
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
index 9fc9a9675..1f2a71bc9 100644
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -43,7 +43,7 @@ func CheckShortCodeMatchAndError(t *testing.T, input, expected string, withTempl
t.Helper()
cfg, fs := newTestCfg()
- cfg.Set("markup", map[string]interface{}{
+ cfg.Set("markup", map[string]any{
"defaultMarkdownHandler": "blackfriday", // TODO(bep)
})
@@ -458,7 +458,7 @@ func TestShortcodesInSite(t *testing.T) {
contentPath string
content string
outFile string
- expected interface{}
+ expected any
}{
{
"sect/doc1.md", `a{{< b >}}c`,
@@ -612,15 +612,15 @@ title: "Foo"
cfg.Set("uglyURLs", false)
cfg.Set("verbose", true)
- cfg.Set("security", map[string]interface{}{
- "exec": map[string]interface{}{
+ cfg.Set("security", map[string]any{
+ "exec": map[string]any{
"allow": []string{"^python$", "^rst2html.*", "^asciidoctor$"},
},
})
cfg.Set("markup.highlight.noClasses", false)
cfg.Set("markup.highlight.codeFences", true)
- cfg.Set("markup", map[string]interface{}{
+ cfg.Set("markup", map[string]any{
"defaultMarkdownHandler": "blackfriday", // TODO(bep)
})
@@ -821,7 +821,7 @@ func TestReplaceShortcodeTokens(t *testing.T) {
input string
prefix string
replacements map[string]string
- expect interface{}
+ expect any
}{
{"Hello HAHAHUGOSHORTCODE-1HBHB.", "PREFIX", map[string]string{"HAHAHUGOSHORTCODE-1HBHB": "World"}, "Hello World."},
{"Hello HAHAHUGOSHORTCODE-1@}@.", "PREFIX", map[string]string{"HAHAHUGOSHORTCODE-1HBHB": "World"}, false},
@@ -1279,10 +1279,10 @@ func TestShortcodeRef(t *testing.T) {
v := config.New()
v.Set("baseURL", "https://example.org")
- v.Set("blackfriday", map[string]interface{}{
+ v.Set("blackfriday", map[string]any{
"plainIDAnchors": plainIDAnchors,
})
- v.Set("markup", map[string]interface{}{
+ v.Set("markup", map[string]any{
"defaultMarkdownHandler": "blackfriday", // TODO(bep)
})
diff --git a/hugolib/site.go b/hugolib/site.go
index c76bdc141..59326cab6 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -228,7 +228,7 @@ func (s *Site) prepareInits() {
var init lazy.Init
- s.init.prevNext = init.Branch(func() (interface{}, error) {
+ s.init.prevNext = init.Branch(func() (any, error) {
regularPages := s.RegularPages()
for i, p := range regularPages {
np, ok := p.(nextPrevProvider)
@@ -255,7 +255,7 @@ func (s *Site) prepareInits() {
return nil, nil
})
- s.init.prevNextInSection = init.Branch(func() (interface{}, error) {
+ s.init.prevNextInSection = init.Branch(func() (any, error) {
var sections page.Pages
s.home.treeRef.m.collectSectionsRecursiveIncludingSelf(pageMapQuery{Prefix: s.home.treeRef.key}, func(n *contentNode) {
sections = append(sections, n.p)
@@ -312,12 +312,12 @@ func (s *Site) prepareInits() {
return nil, nil
})
- s.init.menus = init.Branch(func() (interface{}, error) {
+ s.init.menus = init.Branch(func() (any, error) {
s.assembleMenus()
return nil, nil
})
- s.init.taxonomies = init.Branch(func() (interface{}, error) {
+ s.init.taxonomies = init.Branch(func() (any, error) {
err := s.pageMap.assembleTaxonomies()
return nil, err
})
@@ -433,8 +433,8 @@ But this also means that your site configuration may not do what you expect. If
}
var (
- mediaTypesConfig []map[string]interface{}
- outputFormatsConfig []map[string]interface{}
+ mediaTypesConfig []map[string]any
+ outputFormatsConfig []map[string]any
siteOutputFormatsConfig output.Formats
siteMediaTypesConfig media.Types
@@ -473,7 +473,7 @@ But this also means that your site configuration may not do what you expect. If
siteOutputFormatsConfig = tmp
}
- var siteOutputs map[string]interface{}
+ var siteOutputs map[string]any
if cfg.Language.IsSet("outputs") {
siteOutputs = cfg.Language.GetStringMap("outputs")
@@ -654,7 +654,7 @@ type SiteInfo struct {
hugoInfo hugo.Info
title string
RSSLink string
- Author map[string]interface{}
+ Author map[string]any
LanguageCode string
Copyright string
@@ -709,7 +709,7 @@ func (s *SiteInfo) Menus() navigation.Menus {
}
// TODO(bep) type
-func (s *SiteInfo) Taxonomies() interface{} {
+func (s *SiteInfo) Taxonomies() any {
return s.s.Taxonomies()
}
@@ -717,7 +717,7 @@ func (s *SiteInfo) Params() maps.Params {
return s.s.Language().Params()
}
-func (s *SiteInfo) Data() map[string]interface{} {
+func (s *SiteInfo) Data() map[string]any {
return s.s.h.Data()
}
@@ -786,7 +786,7 @@ type SiteSocial map[string]string
// Param is a convenience method to do lookups in SiteInfo's Params map.
//
// This method is also implemented on Page.
-func (s *SiteInfo) Param(key interface{}) (interface{}, error) {
+func (s *SiteInfo) Param(key any) (any, error) {
return resource.Param(s, nil, key)
}
@@ -826,7 +826,7 @@ func (s siteRefLinker) logNotFound(ref, what string, p page.Page, position text.
}
}
-func (s *siteRefLinker) refLink(ref string, source interface{}, relative bool, outputFormat string) (string, error) {
+func (s *siteRefLinker) refLink(ref string, source any, relative bool, outputFormat string) (string, error) {
p, err := unwrapPage(source)
if err != nil {
return "", err
@@ -1493,7 +1493,7 @@ func (s *Site) assembleMenus() {
sectionPagesMenu := s.Info.sectionPagesMenu
if sectionPagesMenu != "" {
- s.pageMap.sections.Walk(func(s string, v interface{}) bool {
+ s.pageMap.sections.Walk(func(s string, v any) bool {
p := v.(*contentNode).p
if p.IsHome() {
return false
@@ -1695,7 +1695,7 @@ func (s *Site) lookupLayouts(layouts ...string) tpl.Template {
return nil
}
-func (s *Site) renderAndWriteXML(statCounter *uint64, name string, targetPath string, d interface{}, templ tpl.Template) error {
+func (s *Site) renderAndWriteXML(statCounter *uint64, name string, targetPath string, d any, templ tpl.Template) error {
s.Log.Debugf("Render XML for %q to %q", name, targetPath)
renderBuffer := bp.GetBuffer()
defer bp.PutBuffer(renderBuffer)
@@ -1779,7 +1779,7 @@ type hookRendererTemplate struct {
templateHandler tpl.TemplateHandler
identity.SearchProvider
templ tpl.Template
- resolvePosition func(ctx interface{}) text.Position
+ resolvePosition func(ctx any) text.Position
}
func (hr hookRendererTemplate) RenderLink(w io.Writer, ctx hooks.LinkContext) error {
@@ -1794,7 +1794,7 @@ func (hr hookRendererTemplate) RenderCodeblock(w hugio.FlexiWriter, ctx hooks.Co
return hr.templateHandler.Execute(hr.templ, w, ctx)
}
-func (hr hookRendererTemplate) ResolvePosition(ctx interface{}) text.Position {
+func (hr hookRendererTemplate) ResolvePosition(ctx any) text.Position {
return hr.resolvePosition(ctx)
}
@@ -1802,7 +1802,7 @@ func (hr hookRendererTemplate) IsDefaultCodeBlockRenderer() bool {
return false
}
-func (s *Site) renderForTemplate(name, outputFormat string, d interface{}, w io.Writer, templ tpl.Template) (err error) {
+func (s *Site) renderForTemplate(name, outputFormat string, d any, w io.Writer, templ tpl.Template) (err error) {
if templ == nil {
s.logMissingLayout(name, "", "", outputFormat)
return nil
@@ -1871,7 +1871,7 @@ func (s *Site) newPage(
parentbBucket *pagesMapBucket,
kind, title string,
sections ...string) *pageState {
- m := map[string]interface{}{}
+ m := map[string]any{}
if title != "" {
m["title"] = title
}
diff --git a/hugolib/site_output.go b/hugolib/site_output.go
index c9c9f0ae5..1e248baff 100644
--- a/hugolib/site_output.go
+++ b/hugolib/site_output.go
@@ -53,7 +53,7 @@ func createDefaultOutputFormats(allFormats output.Formats) map[string]output.For
return m
}
-func createSiteOutputFormats(allFormats output.Formats, outputs map[string]interface{}, rssDisabled bool) (map[string]output.Formats, error) {
+func createSiteOutputFormats(allFormats output.Formats, outputs map[string]any, rssDisabled bool) (map[string]output.Formats, error) {
defaultOutputFormats := createDefaultOutputFormats(allFormats)
if outputs == nil {
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go
index 815625ff1..843a13248 100644
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -327,9 +327,9 @@ baseName = "customdelimbase"
// Issue 8030
func TestGetOutputFormatRel(t *testing.T) {
b := newTestSitesBuilder(t).
- WithSimpleConfigFileAndSettings(map[string]interface{}{
- "outputFormats": map[string]interface{}{
- "humansTXT": map[string]interface{}{
+ WithSimpleConfigFileAndSettings(map[string]any{
+ "outputFormats": map[string]any{
+ "humansTXT": map[string]any{
"name": "HUMANS",
"mediaType": "text/plain",
"baseName": "humans",
@@ -358,7 +358,7 @@ func TestCreateSiteOutputFormats(t *testing.T) {
t.Run("Basic", func(t *testing.T) {
c := qt.New(t)
- outputsConfig := map[string]interface{}{
+ outputsConfig := map[string]any{
page.KindHome: []string{"HTML", "JSON"},
page.KindSection: []string{"JSON"},
}
@@ -390,7 +390,7 @@ func TestCreateSiteOutputFormats(t *testing.T) {
c := qt.New(t)
cfg := config.New()
- outputsConfig := map[string]interface{}{
+ outputsConfig := map[string]any{
// Note that we in Hugo 0.53.0 renamed this Kind to "taxonomy",
// but keep this test to test the legacy mapping.
"taxonomyterm": []string{"JSON"},
@@ -406,7 +406,7 @@ func TestCreateSiteOutputFormats(t *testing.T) {
func TestCreateSiteOutputFormatsInvalidConfig(t *testing.T) {
c := qt.New(t)
- outputsConfig := map[string]interface{}{
+ outputsConfig := map[string]any{
page.KindHome: []string{"FOO", "JSON"},
}
@@ -420,7 +420,7 @@ func TestCreateSiteOutputFormatsInvalidConfig(t *testing.T) {
func TestCreateSiteOutputFormatsEmptyConfig(t *testing.T) {
c := qt.New(t)
- outputsConfig := map[string]interface{}{
+ outputsConfig := map[string]any{
page.KindHome: []string{},
}
@@ -435,7 +435,7 @@ func TestCreateSiteOutputFormatsEmptyConfig(t *testing.T) {
func TestCreateSiteOutputFormatsCustomFormats(t *testing.T) {
c := qt.New(t)
- outputsConfig := map[string]interface{}{
+ outputsConfig := map[string]any{
page.KindHome: []string{},
}
diff --git a/hugolib/site_render.go b/hugolib/site_render.go
index 77ece780b..c09e5cc99 100644
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -153,7 +153,7 @@ func (s *Site) logMissingLayout(name, layout, kind, outputFormat string) {
}
errMsg := "You should create a template file which matches Hugo Layouts Lookup Rules for this combination."
- var args []interface{}
+ var args []any
msg := "found no layout file for"
if outputFormat != "" {
msg += " %q"
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index 73cea855a..1012144fb 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -56,7 +56,7 @@ func TestDraftAndFutureRender(t *testing.T) {
{filepath.FromSlash("sect/doc4.md"), "---\ntitle: doc4\ndraft: false\npublishdate: \"2012-05-29\"\n---\n# doc4\n*some content*"},
}
- siteSetup := func(t *testing.T, configKeyValues ...interface{}) *Site {
+ siteSetup := func(t *testing.T, configKeyValues ...any) *Site {
cfg, fs := newTestCfg()
cfg.Set("baseURL", "http://auth/bub")
@@ -288,7 +288,7 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
cfg.Set("verbose", true)
cfg.Set("baseURL", "http://auth/bub")
cfg.Set("blackfriday",
- map[string]interface{}{
+ map[string]any{
"plainIDAnchors": true,
})
@@ -364,7 +364,7 @@ func TestMainSections(t *testing.T) {
c.Run(fmt.Sprintf("param-%t", paramSet), func(c *qt.C) {
v := config.New()
if paramSet {
- v.Set("params", map[string]interface{}{
+ v.Set("params", map[string]any{
"mainSections": []string{"a1", "a2"},
})
}
@@ -882,13 +882,13 @@ func setupLinkingMockSite(t *testing.T) *Site {
cfg.Set("baseURL", "http://auth/")
cfg.Set("uglyURLs", false)
- cfg.Set("outputs", map[string]interface{}{
+ cfg.Set("outputs", map[string]any{
"page": []string{"HTML", "AMP"},
})
cfg.Set("pluralizeListTitles", false)
cfg.Set("canonifyURLs", false)
cfg.Set("blackfriday",
- map[string]interface{}{})
+ map[string]any{})
writeSourcesToSource(t, "content", fs, sources...)
return buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
}
diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go
index 3fa6ab3ae..28d7d6eb5 100644
--- a/hugolib/sitemap_test.go
+++ b/hugolib/sitemap_test.go
@@ -88,7 +88,7 @@ func doTestSitemapOutput(t *testing.T, internal bool) {
func TestParseSitemap(t *testing.T) {
t.Parallel()
expected := config.Sitemap{Priority: 3.0, Filename: "doo.xml", ChangeFreq: "3"}
- input := map[string]interface{}{
+ input := map[string]any{
"changefreq": "3",
"priority": 3.0,
"filename": "doo.xml",
diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go
index e03ea5363..7b259a2d4 100644
--- a/hugolib/testhelpers_test.go
+++ b/hugolib/testhelpers_test.go
@@ -173,7 +173,7 @@ func (s *sitesBuilder) WithEnviron(env ...string) *sitesBuilder {
return s
}
-func (s *sitesBuilder) WithConfigTemplate(data interface{}, format, configTemplate string) *sitesBuilder {
+func (s *sitesBuilder) WithConfigTemplate(data any, format, configTemplate string) *sitesBuilder {
s.T.Helper()
if format == "" {
@@ -279,10 +279,10 @@ func (s *sitesBuilder) WithSimpleConfigFile() *sitesBuilder {
func (s *sitesBuilder) WithSimpleConfigFileAndBaseURL(baseURL string) *sitesBuilder {
s.T.Helper()
- return s.WithSimpleConfigFileAndSettings(map[string]interface{}{"baseURL": baseURL})
+ return s.WithSimpleConfigFileAndSettings(map[string]any{"baseURL": baseURL})
}
-func (s *sitesBuilder) WithSimpleConfigFileAndSettings(settings interface{}) *sitesBuilder {
+func (s *sitesBuilder) WithSimpleConfigFileAndSettings(settings any) *sitesBuilder {
s.T.Helper()
var buf bytes.Buffer
parser.InterfaceToConfig(settings, metadecoders.TOML, &buf)
@@ -690,7 +690,7 @@ hello:
}
}
-func (s *sitesBuilder) Fatalf(format string, args ...interface{}) {
+func (s *sitesBuilder) Fatalf(format string, args ...any) {
s.T.Helper()
s.T.Fatalf(format, args...)
}
@@ -784,7 +784,7 @@ func (s *sitesBuilder) FileContent(filename string) string {
return readDestination(s.T, s.Fs, filename)
}
-func (s *sitesBuilder) AssertObject(expected string, object interface{}) {
+func (s *sitesBuilder) AssertObject(expected string, object any) {
s.T.Helper()
got := s.dumper.Sdump(object)
expected = strings.TrimSpace(expected)