pelletier / go-toml

Go library for the TOML file format
https://github.com/pelletier/go-toml
Other
1.69k stars 206 forks source link

Apply multiline tag to value instead of container for non-arrays #828

Open pelletier opened 1 year ago

pelletier commented 1 year ago

Discussed in https://github.com/pelletier/go-toml/discussions/823

Instead of multiline being a no-op when used on non-string or non-array, it should be pushed down for the value if it is an array. I think this would match people's expectations, as seen in the discussion.

For a case like this:

struct {
  Field map[string][][]string `toml:",multiline"`
}

it should only make the outer array multiline. Maybe at some point we'll need a different API for those who want more granular control to emit toml.