mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user