MCPcopy
hub / github.com/hashicorp/hcl / decodeBodyToValue

Function decodeBodyToValue

gohcl/decode.go:43–53  ·  view source on GitHub ↗
(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value)

Source from the content-addressed store, hash-verified

41}
42
43func decodeBodyToValue(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics {
44 et := val.Type()
45 switch et.Kind() {
46 case reflect.Struct:
47 return decodeBodyToStruct(body, ctx, val)
48 case reflect.Map:
49 return decodeBodyToMap(body, ctx, val)
50 default:
51 panic(fmt.Sprintf("target value must be pointer to struct or map, not %s", et.String()))
52 }
53}
54
55func decodeBodyToStruct(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics {
56 schema, partial := ImpliedBodySchema(val.Interface())

Callers 3

DecodeBodyFunction · 0.85
decodeBodyToStructFunction · 0.85
decodeBlockToValueFunction · 0.85

Calls 4

decodeBodyToStructFunction · 0.85
decodeBodyToMapFunction · 0.85
TypeMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected