-
-
Notifications
You must be signed in to change notification settings - Fork 219
Example of adding comments to yaml structure from a struct? #842
Copy link
Copy link
Open
Description
I'm looking for a way to marshal a struct with comments. Ideally, these comments are dynamic in nature, but static is acceptable. Here's an example use case:
type Foo struct {
Bar `yaml:"bar", yaml_comment:"Bar is for doing bar things"`
}If I were to marshal this, maybe it would look like this:
foo := foo{Bar: "my-bar"}
yaml.Marshal(&foo)# Bar is for doing bar things
bar: my-barIs something like this possible? Maybe in a round-about way like with path https://github.com/goccy/go-yaml#51-print-customized-error-with-yaml-source-code ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels