Skip to content
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

gohcl: Struct Embedding #667

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cam72cam
Copy link

A common pattern that does not currently work for decoding hcl is:

type Base struct {
    Field string `hcl:"my_field"`
}

type Variant struct {
    Base
    Value int `hcl:"my_value"`
}

This is fixed by making some recursive tweaks to schema.go and corresponding changes in decode and encode.

This code is functional for decode, but still requires encode changes as well as test coverage. I may end up refactoring this a bit as I fiddle with encode, but the core functionality is there.

Still needs encoder changes and tests
@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants