summaryrefslogtreecommitdiffstats
path: root/output
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /output
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'output')
-rw-r--r--output/docshelper.go4
-rw-r--r--output/outputFormat.go6
-rw-r--r--output/outputFormat_test.go20
3 files changed, 15 insertions, 15 deletions
diff --git a/output/docshelper.go b/output/docshelper.go
index 7e1f502df..abfedd148 100644
--- a/output/docshelper.go
+++ b/output/docshelper.go
@@ -12,7 +12,7 @@ import (
func init() {
docsProvider := func() docshelper.DocProvider {
return docshelper.DocProvider{
- "output": map[string]interface{}{
+ "output": map[string]any{
"formats": DefaultFormats,
"layouts": createLayoutExamples(),
},
@@ -22,7 +22,7 @@ func init() {
docshelper.AddDocProviderFunc(docsProvider)
}
-func createLayoutExamples() interface{} {
+func createLayoutExamples() any {
type Example struct {
Example string
Kind string
diff --git a/output/outputFormat.go b/output/outputFormat.go
index 091d3accb..34bec9911 100644
--- a/output/outputFormat.go
+++ b/output/outputFormat.go
@@ -292,7 +292,7 @@ func (formats Formats) FromFilename(filename string) (f Format, found bool) {
// DecodeFormats takes a list of output format configurations and merges those,
// in the order given, with the Hugo defaults as the last resort.
-func DecodeFormats(mediaTypes media.Types, maps ...map[string]interface{}) (Formats, error) {
+func DecodeFormats(mediaTypes media.Types, maps ...map[string]any) (Formats, error) {
f := make(Formats, len(DefaultFormats))
copy(f, DefaultFormats)
@@ -334,12 +334,12 @@ func DecodeFormats(mediaTypes media.Types, maps ...map[string]interface{}) (Form
return f, nil
}
-func decode(mediaTypes media.Types, input interface{}, output *Format) error {
+func decode(mediaTypes media.Types, input any, output *Format) error {
config := &mapstructure.DecoderConfig{
Metadata: nil,
Result: output,
WeaklyTypedInput: true,
- DecodeHook: func(a reflect.Type, b reflect.Type, c interface{}) (interface{}, error) {
+ DecodeHook: func(a reflect.Type, b reflect.Type, c any) (any, error) {
if a.Kind() == reflect.Map {
dataVal := reflect.Indirect(reflect.ValueOf(c))
for _, key := range dataVal.MapKeys() {
diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go
index fc45099f3..a150dbe7c 100644
--- a/output/outputFormat_test.go
+++ b/output/outputFormat_test.go
@@ -145,15 +145,15 @@ func TestDecodeFormats(t *testing.T) {
tests := []struct {
name string
- maps []map[string]interface{}
+ maps []map[string]any
shouldError bool
assert func(t *testing.T, name string, f Formats)
}{
{
"Redefine JSON",
- []map[string]interface{}{
+ []map[string]any{
{
- "JsON": map[string]interface{}{
+ "JsON": map[string]any{
"baseName": "myindex",
"isPlainText": "false",
},
@@ -171,9 +171,9 @@ func TestDecodeFormats(t *testing.T) {
},
{
"Add XML format with string as mediatype",
- []map[string]interface{}{
+ []map[string]any{
{
- "MYXMLFORMAT": map[string]interface{}{
+ "MYXMLFORMAT": map[string]any{
"baseName": "myxml",
"mediaType": "application/xml",
},
@@ -194,9 +194,9 @@ func TestDecodeFormats(t *testing.T) {
},
{
"Add format unknown mediatype",
- []map[string]interface{}{
+ []map[string]any{
{
- "MYINVALID": map[string]interface{}{
+ "MYINVALID": map[string]any{
"baseName": "mymy",
"mediaType": "application/hugo",
},
@@ -208,15 +208,15 @@ func TestDecodeFormats(t *testing.T) {
},
{
"Add and redefine XML format",
- []map[string]interface{}{
+ []map[string]any{
{
- "MYOTHERXMLFORMAT": map[string]interface{}{
+ "MYOTHERXMLFORMAT": map[string]any{
"baseName": "myotherxml",
"mediaType": media.XMLType,
},
},
{
- "MYOTHERXMLFORMAT": map[string]interface{}{
+ "MYOTHERXMLFORMAT": map[string]any{
"baseName": "myredefined",
},
},