-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
featureIssue asking for a new feature in go-toml.Issue asking for a new feature in go-toml.
Description
type a struct{ B b }
type b struct{ C c }
type c struct{ D d }
type d struct{ S string }
func main() {
var test a
test.B.C.D.S = "foo"
out, err := toml.Marshal(test)
if err != nil {
panic(err)
}
fmt.Println(string(out))
}
will output the following marshaled toml:
[B]
[B.C]
[B.C.D]
S = 'foo'
Citing the TOML spec
# [x] you
# [x.y] don't
# [x.y.z] need these
[x.y.z.w] # for this to work
So it would be nice if there would be a way to omit the empty super-table headers.
This is especially useful in case your last element in the path (D
/w
) is known to be unique, and you want to append a toml snippet to an existing toml file. If you marshal the snippet and it contains the empty super-table headers, you might redefine the super-table if it is already present in the file your appending to.
voler88
Metadata
Metadata
Assignees
Labels
featureIssue asking for a new feature in go-toml.Issue asking for a new feature in go-toml.