rodaine / hclencoder

HCL Encoder/Marshaller - Convert Go Types into HCL files
https://godoc.org/github.com/rodaine/hclencoder
MIT License
76 stars 32 forks source link

Key tag is not inherited from squashed struct #12

Closed avorima closed 5 years ago

avorima commented 5 years ago

Assuming we have the following data structures:

type Foo struct {
    Name string `hcl:",key"`
    A int `hcl:"a"`
}

type Bar struct {
    Foo `hcl:",squash"`
    B int `hcl:"b"`
}

type Baz struct {
    Bar Bar `hcl:"bar"`
}

Encoding Baz will omit the Name field of the Foo struct.

rodaine commented 5 years ago

Thanks for the report! Feel free to submit a patch if you can figure out a fix and I'll review 😁