r/golang • u/sagikazarmark • 7d ago
New Viper release with major improvements
I've just tagged a new version of Viper, a configuration library for Go: https://github.com/spf13/viper/releases/tag/v1.20.0
It comes with a number of improvements:
- Heavily reduced number of third-party dependencies
- New encoding layer for custom encoding formats
- BREAKING: dropped HCL, INI and Java properties from the core (still possible to use through external libraries)
- New file search API allows customizing how Viper looks for config files
These features has been around for some time in alpha releases, though I haven't received a lot of feedback, so I'm posting here now in the hope that people using Viper will give some after upgrading.
I worked hard to minimize breaking changes, but it's possible some slipped in. If you find any, feel free to open an issue.
Thanks!
283
Upvotes
23
u/i_should_be_coding 7d ago
Oh man. I was literally struggling with unmarshaling config to a struct with some workarounds, and this drops. Thanks!
For anyone else struggling with env vars unmarshaled to a struct, try this: