aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-03-17 22:03:27 +0100
committerBjørn Erik Pedersen <[email protected]>2022-03-17 22:03:27 +0100
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /modules
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
downloadhugo-b80853de90b10171155b8f3fde47d64ec7bfa0dd.tar.gz
hugo-b80853de90b10171155b8f3fde47d64ec7bfa0dd.zip
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'modules')
-rw-r--r--modules/collect.go4
-rw-r--r--modules/config.go6
-rw-r--r--modules/npm/package_builder.go28
-rw-r--r--modules/npm/package_builder_test.go4
4 files changed, 21 insertions, 21 deletions
diff --git a/modules/collect.go b/modules/collect.go
index 44d714a67..e012d4696 100644
--- a/modules/collect.go
+++ b/modules/collect.go
@@ -408,7 +408,7 @@ func (c *collector) applyMounts(moduleImport Import, mod *moduleAdapter) error {
func (c *collector) applyThemeConfig(tc *moduleAdapter) error {
var (
configFilename string
- themeCfg map[string]interface{}
+ themeCfg map[string]any
hasConfigFile bool
err error
)
@@ -487,7 +487,7 @@ func (c *collector) applyThemeConfig(tc *moduleAdapter) error {
}
if config.Params == nil {
- config.Params = make(map[string]interface{})
+ config.Params = make(map[string]any)
}
for k, v := range themeCfg {
diff --git a/modules/config.go b/modules/config.go
index 4b39636cd..ada39cc1f 100644
--- a/modules/config.go
+++ b/modules/config.go
@@ -270,7 +270,7 @@ type Config struct {
Imports []Import
// Meta info about this module (license information etc.).
- Params map[string]interface{}
+ Params map[string]any
// Will be validated against the running Hugo version.
HugoVersion HugoVersion
@@ -386,10 +386,10 @@ type Mount struct {
Lang string // any language code associated with this mount.
// Include only files matching the given Glob patterns (string or slice).
- IncludeFiles interface{}
+ IncludeFiles any
// Exclude all files matching the given Glob patterns (string or slice).
- ExcludeFiles interface{}
+ ExcludeFiles any
}
// Used as key to remove duplicates.
diff --git a/modules/npm/package_builder.go b/modules/npm/package_builder.go
index aa9ecb35b..911241813 100644
--- a/modules/npm/package_builder.go
+++ b/modules/npm/package_builder.go
@@ -119,12 +119,12 @@ func Pack(fs afero.Fs, fis []hugofs.FileMetaInfo) error {
// Replace the dependencies in the original template with the merged set.
b.originalPackageJSON[dependenciesKey] = b.dependencies
b.originalPackageJSON[devDependenciesKey] = b.devDependencies
- var commentsm map[string]interface{}
+ var commentsm map[string]any
comments, found := b.originalPackageJSON["comments"]
if found {
commentsm = maps.ToStringMap(comments)
} else {
- commentsm = make(map[string]interface{})
+ commentsm = make(map[string]any)
}
commentsm[dependenciesKey] = b.dependenciesComments
commentsm[devDependenciesKey] = b.devDependenciesComments
@@ -148,10 +148,10 @@ func Pack(fs afero.Fs, fis []hugofs.FileMetaInfo) error {
func newPackageBuilder(source string, first io.Reader) *packageBuilder {
b := &packageBuilder{
- devDependencies: make(map[string]interface{}),
- devDependenciesComments: make(map[string]interface{}),
- dependencies: make(map[string]interface{}),
- dependenciesComments: make(map[string]interface{}),
+ devDependencies: make(map[string]any),
+ devDependenciesComments: make(map[string]any),
+ dependencies: make(map[string]any),
+ dependenciesComments: make(map[string]any),
}
m := b.unmarshal(first)
@@ -169,12 +169,12 @@ type packageBuilder struct {
err error
// The original package.hugo.json.
- originalPackageJSON map[string]interface{}
+ originalPackageJSON map[string]any
- devDependencies map[string]interface{}
- devDependenciesComments map[string]interface{}
- dependencies map[string]interface{}
- dependenciesComments map[string]interface{}
+ devDependencies map[string]any
+ devDependenciesComments map[string]any
+ dependencies map[string]any
+ dependenciesComments map[string]any
}
func (b *packageBuilder) Add(source string, r io.Reader) *packageBuilder {
@@ -192,7 +192,7 @@ func (b *packageBuilder) Add(source string, r io.Reader) *packageBuilder {
return b
}
-func (b *packageBuilder) addm(source string, m map[string]interface{}) {
+func (b *packageBuilder) addm(source string, m map[string]any) {
if source == "" {
source = "project"
}
@@ -225,8 +225,8 @@ func (b *packageBuilder) addm(source string, m map[string]interface{}) {
}
}
-func (b *packageBuilder) unmarshal(r io.Reader) map[string]interface{} {
- m := make(map[string]interface{})
+func (b *packageBuilder) unmarshal(r io.Reader) map[string]any {
+ m := make(map[string]any)
err := json.Unmarshal(helpers.ReaderToBytes(r), &m)
if err != nil {
b.err = err
diff --git a/modules/npm/package_builder_test.go b/modules/npm/package_builder_test.go
index 510a04776..2523292ee 100644
--- a/modules/npm/package_builder_test.go
+++ b/modules/npm/package_builder_test.go
@@ -73,7 +73,7 @@ func TestPackageBuilder(t *testing.T) {
c.Assert(b.Err(), qt.IsNil)
- c.Assert(b.dependencies, qt.DeepEquals, map[string]interface{}{
+ c.Assert(b.dependencies, qt.DeepEquals, map[string]any{
"@babel/cli": "7.8.4",
"add1": "1.1.1",
"add3": "3.1.1",
@@ -83,7 +83,7 @@ func TestPackageBuilder(t *testing.T) {
"tailwindcss": "1.2.0",
})
- c.Assert(b.devDependencies, qt.DeepEquals, map[string]interface{}{
+ c.Assert(b.devDependencies, qt.DeepEquals, map[string]any{
"tailwindcss": "1.2.0",
"@babel/cli": "7.8.4",
"@babel/core": "7.9.0",