-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decoding issue for complex type #718
Comments
Hi @valentinwidmer, HCL's own decoder only deals with HCL blocks and arguments, before delegating to an upstream library called "cty" to deal with the values of those arguments. In your example you only have a single HCL argument called For dealing with the result of this expression -- which is a For the relatively simple fields in your Your |
Thanks for the explanation @apparentlymart ! Actually the extra label field contains an object itself. Further there are more complex structures nested further down (map which contains map of objects) that I did not add as an example. Overall I just want to append a new namespace to this map. Are you aware of another library/solution which could solve my problem? |
I'm receiving a strange error message while trying to parse the following HCL structure:
I would like to convert this HCL structure into a Go struct:
While running the code I receive the following error message:
"errorMessage": "unsuitable DecodeExpression target: no cty.Type for main.Namespace (no cty field tags)", "errorType": "string", "stackTrace": [{"path": "github.com/aws/[email protected]/lambda/errors.go", "line": 39, "label": "lambdaPanicResponse"}, {"path": "github.com/aws/[email protected]/lambda/invoke_loop.go", "line": 102, "label": "callBytesHandlerFunc.func1"}, {"path": "runtime/panic.go", "line": 785, "label": "gopanic"}, {"path": "github.com/hashicorp/hcl/[email protected]/gohcl/decode.go", "line": 296, "label": "DecodeExpression"}, {"path": "github.com/hashicorp/hcl/[email protected]/gohcl/decode.go", "line": 127, "label": "decodeBodyToStruct"}, {"path": "github.com/hashicorp/hcl/[email protected]/gohcl/decode.go", "line": 46, "label": "decodeBodyToValue"}, {"path": "github.com/hashicorp/hcl/[email protected]/gohcl/decode.go", "line": 39, "label": "DecodeBody"}, {"path": "hello-world/main.go", "line": 63, "label": "handler"}, {"path": "reflect/value.go", "line": 581, "label": "Value.call"}, {"path": "reflect/value.go", "line": 365, "label": "Value.Call"}, {"path": "github.com/aws/[email protected]/lambda/handler.go", "line": 253, "label": "reflectHandler.func1"}, {"path": "github.com/aws/[email protected]/lambda/handler.go", "line": 194, "label": "bytesHandlerFunc.Invoke"}, {"path": "github.com/aws/[email protected]/lambda/invoke_loop.go", "line": 105, "label": "callBytesHandlerFunc"}, {"path": "github.com/aws/[email protected]/lambda/invoke_loop.go", "line": 73, "label": "handleInvoke"}, {"path": "github.com/aws/[email protected]/lambda/invoke_loop.go", "line": 37, "label": "startRuntimeAPILoop"}, {"path": "github.com/aws/[email protected]/lambda/entry.go", "line": 103, "label": "start"}, {"path": "github.com/aws/[email protected]/lambda/entry.go", "line": 66, "label": "StartWithOptions"}, {"path": "github.com/aws/[email protected]/lambda/entry.go", "line": 42, "label": "Start"}, {"path": "hello-world/main.go", "line": 157, "label": "main"}, {"path": "runtime/proc.go", "line": 272, "label": "main"}, {"path": "runtime/asm_amd64.s", "line": 1700, "label": "goexit"}]}
The text was updated successfully, but these errors were encountered: