jsonconfig: Use "any" instead of interface{}

Since Go 1.18, "any" is the preferred spelling of the empty interface type.
This quiets some complaints from linters that the OpenTofu project does
not enforce but nonetheless may be enabled in the Go support for certain
text editors.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
Martin Atkins
2025-07-08 15:42:51 -07:00
parent 6a27c82bb4
commit a55053ea40
2 changed files with 21 additions and 21 deletions

View File

@@ -92,7 +92,7 @@ func (e *expression) Empty() bool {
// expressions is used to represent the entire content of a block. Attribute
// arguments are mapped directly with the attribute name as key and an
// expression as value.
type expressions map[string]interface{}
type expressions map[string]any
// marshalExpressions returns a representation of the expressions in the given
// body after analyzing based on the given schema.
@@ -151,16 +151,16 @@ func marshalExpressions(body hcl.Body, schema *configschema.Block) expressions {
ret[typeName] = marshalExpressions(block.Body, &blockS.Block)
case configschema.NestingList, configschema.NestingSet:
if _, exists := ret[typeName]; !exists {
ret[typeName] = make([]map[string]interface{}, 0, 1)
ret[typeName] = make([]map[string]any, 0, 1)
}
ret[typeName] = append(ret[typeName].([]map[string]interface{}), marshalExpressions(block.Body, &blockS.Block))
ret[typeName] = append(ret[typeName].([]map[string]any), marshalExpressions(block.Body, &blockS.Block))
case configschema.NestingMap:
if _, exists := ret[typeName]; !exists {
ret[typeName] = make(map[string]map[string]interface{})
ret[typeName] = make(map[string]map[string]any)
}
// NestingMap blocks always have the key in the first (and only) label
key := block.Labels[0]
retMap := ret[typeName].(map[string]map[string]interface{})
retMap := ret[typeName].(map[string]map[string]any)
retMap[key] = marshalExpressions(block.Body, &blockS.Block)
}
}