You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go run viper.go
data from 1.yaml
map[test:{ }]
$ cat 1.yaml
test:
member_a: a
member_b: b
Steps To Reproduce
No response
Additional Information
Unmarshal works with tag mapstructure but WriteConfigAs works with tag yaml when the yaml key is snake case like member_a.
Even the member has both two tags, the problem is still existed:
type Data struct {
MemberA string `yaml:"member_a" ,mapstructure: "member_a"`
MemberB string `yaml:"member_b" ,mapstructure: "member_b"`
}
The text was updated successfully, but these errors were encountered:
Preflight Checklist
Viper Version
1.19.0
Go Version
1.22.5
Config Source
Files
Format
YAML
Repl.it link
No response
Code reproducing the issue
Expected Behavior
The data read from
1.yaml
is correct.Actual Behavior
Steps To Reproduce
No response
Additional Information
Unmarshal
works with tagmapstructure
butWriteConfigAs
works with tagyaml
when the yaml key is snake case likemember_a
.Even the member has both two tags, the problem is still existed:
The text was updated successfully, but these errors were encountered: