Closed mitchellh closed 5 years ago
type config struct { Other string `hcl:"other"` Field bool `hcl:"field,optional"` } input := &config{Field: true, Other: "hello"} fw := hclwrite.NewEmptyFile() gohcl.EncodeIntoBody(input, fw.Body()) println(string(fw.Bytes()))
The output only contains the required fields, does not contain the optional ones (though set).
My tag was missing : 😑(hcl"field" vs. hcl:"field")
:
hcl"field"
hcl:"field"
So, this probably works.
The output only contains the required fields, does not contain the optional ones (though set).