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

Function Decode

hcldec/public.go:17–20  ·  view source on GitHub ↗

Decode interprets the given body using the given specification and returns the resulting value. If the given body is not valid per the spec, error diagnostics are returned and the returned value is likely to be incomplete. The ctx argument may be nil, in which case any references to variables or fu

(body hcl.Body, spec Spec, ctx *hcl.EvalContext)

Source from the content-addressed store, hash-verified

15// The ctx argument may be nil, in which case any references to variables or
16// functions will produce error diagnostics.
17func Decode(body hcl.Body, spec Spec, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {
18 val, _, diags := decode(body, nil, ctx, spec, false)
19 return val, diags
20}
21
22// PartialDecode is like Decode except that it permits "leftover" items in
23// the top-level body, which are returned as a new body to allow for

Callers 10

realmainFunction · 0.92
TestExpandFunction · 0.92
TestExpandMarkedForEachFunction · 0.92
TestHCLDecDecodeToExprFunction · 0.92
TestTerraformLikeFunction · 0.92
TestDefaultSpecFunction · 0.70
TestValidateFuncSpecFunction · 0.70
TestRefineValueSpecFunction · 0.70
TestDecodeFunction · 0.70

Calls 1

decodeFunction · 0.85

Tested by 9

TestExpandFunction · 0.74
TestExpandMarkedForEachFunction · 0.74
TestHCLDecDecodeToExprFunction · 0.74
TestTerraformLikeFunction · 0.74
TestDefaultSpecFunction · 0.56
TestValidateFuncSpecFunction · 0.56
TestRefineValueSpecFunction · 0.56
TestDecodeFunction · 0.56