Rename common/maps to common/hmaps (#14384)

Go's stdlid now has a maps package, which is very useful. We have been using imports on the form `xmaps "maps"`, but auto import tools doesn't handle this, which is annoying.

I have been thinking about this for some time, but have been holding back because of all the import changes. However, now is a good time to do this, with very little unmerged code.
This commit is contained in:
Bjørn Erik Pedersen
2026-01-16 11:47:46 +01:00
committed by GitHub
parent 94f1ede3aa
commit 608ed09a0a
103 changed files with 591 additions and 604 deletions
+2 -2
View File
@@ -31,9 +31,9 @@ import (
"github.com/gohugoio/hugo/markup/markup_config"
"github.com/gohugoio/hugo/common/hmaps"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/markup/converter"
@@ -398,7 +398,7 @@ func TestConvertAttributes(t *testing.T) {
}
data, err := toml.Marshal(mconf)
c.Assert(err, qt.IsNil)
m := maps.Params{
m := hmaps.Params{
"markup": config.FromTOMLConfigString(string(data)).Get(""),
}
conf := testconfig.GetTestConfig(nil, config.NewFrom(m))
+6 -6
View File
@@ -14,7 +14,7 @@
package markup_config
import (
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/common/hmaps"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/markup/asciidocext/asciidocext_config"
"github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
@@ -52,7 +52,7 @@ func Decode(cfg config.Provider) (conf Config, err error) {
if m == nil {
return
}
m = maps.CleanConfigStringMap(m)
m = hmaps.CleanConfigStringMap(m)
normalizeConfig(m)
@@ -73,9 +73,9 @@ func Decode(cfg config.Provider) (conf Config, err error) {
}
func normalizeConfig(m map[string]any) {
v, err := maps.GetNestedParam("goldmark.parser", ".", m)
v, err := hmaps.GetNestedParam("goldmark.parser", ".", m)
if err == nil {
vm := maps.ToStringMap(v)
vm := hmaps.ToStringMap(v)
// Changed from a bool in 0.81.0
if vv, found := vm["attribute"]; found {
if vvb, ok := vv.(bool); ok {
@@ -87,9 +87,9 @@ func normalizeConfig(m map[string]any) {
}
// Handle changes to the Goldmark configuration.
v, err = maps.GetNestedParam("goldmark.extensions", ".", m)
v, err = hmaps.GetNestedParam("goldmark.extensions", ".", m)
if err == nil {
vm := maps.ToStringMap(v)
vm := hmaps.ToStringMap(v)
// We changed the typographer extension config from a bool to a struct in 0.112.0.
migrateGoldmarkConfig(vm, "typographer", goldmark_config.Typographer{Disable: true})