Releases: spf13/viper
v1.18.0
Major changes
Highlighting some of the changes for better visibility.
Please share your feedback in the Discussion forum. Thanks! ❤️
AutomaticEnv works with Unmarshal
Previously,  environment variables that weren't bound manually or had no defaults could not be mapped by Unmarshal. (The problem is explained in details in this issue: #761)
#1429 introduced a solution that solves that issue.
What's Changed
Enhancements 🚀
- chore: rename files according to enabled build tags by @alexandear in #1642
- test: replace ifs with asserts to simplify tests by @alexandear in #1656
- ci: enable test shuffle and fix tests by @alexandear in #1643
- fix: gocritic lint issues by @alexandear in #1696
Bug Fixes 🐛
- Implement viper.BindStruct for automatic unmarshalling from environment variables by @krakowski in #1429
- fix isPathShadowedInFlatMap type cast bug by @linuxsong in #1585
Dependency Updates ⬆️
- build(deps): bump github/codeql-action from 2.21.9 to 2.22.3 by @dependabot in #1661
- build(deps): bump golang.org/x/net from 0.15.0 to 0.17.0 by @dependabot in #1659
- build(deps): bump actions/checkout from 4.1.0 to 4.1.1 by @dependabot in #1663
- build(deps): bump actions/github-script from 6.4.1 to 7.0.1 by @dependabot in #1686
- build(deps): bump github/codeql-action from 2.22.3 to 2.22.8 by @dependabot in #1688
- build(deps): bump github.com/spf13/afero from 1.10.0 to 1.11.0 by @dependabot in #1692
- build(deps): bump actions/dependency-review-action from 3.1.0 to 3.1.4 by @dependabot in #1690
- build(deps): bump cachix/install-nix-action from 23 to 24 by @dependabot in #1689
- build(deps): bump github.com/nats-io/nkeys from 0.4.5 to 0.4.6 by @dependabot in #1672
- build(deps): bump github.com/spf13/cast from 1.5.1 to 1.6.0 by @dependabot in #1691
- build(deps): bump github.com/fsnotify/fsnotify from 1.6.0 to 1.7.0 by @dependabot in #1668
- chore: update dependencies by @sagikazarmark in #1694
- chore: update crypt by @sagikazarmark in #1701
Other Changes
- Add info about multiple hosts for remote config by @KaymeKaydex in #1684
- refactor: drop fsonitfy wrapper by @sagikazarmark in #1693
- Note Get* behavior on parse failure by @scop in #1687
- fix: godot lint issues by @alexandear in #1657
New Contributors
- @KaymeKaydex made their first contribution in #1684
- @krakowski made their first contribution in #1429
- @linuxsong made their first contribution in #1585
Full Changelog: v1.17.0...v1.18.0
v1.17.0
Major changes
Highlighting some of the changes for better visibility.
Please share your feedback in the Discussion forum. Thanks! ❤️
Minimum Go version: 1.19
Viper now requires Go 1.19
This change ensures we can stay up to date with modern practices and dependencies.
log/slog support [BREAKING]
Viper v1.11.0 added an experimental Logger interface to allow custom implementations (besides jwalterweatherman).
In addition, it also exposed an experimental WithLogger function allowing to set a custom logger.
This release deprecates that interface in favor of log/slog released in Go 1.21.
Warning
WithLogger accepts an *slog.Logger from now on.
To preserve backwards compatibility with older Go versions, prior to Go 1.21 Viper accepts a *golang.org/x/exp/slog.Logger.
The experimental flag is removed.
New finder implementation [BREAKING]
As of this release, Viper uses a new library to look for files, called locafero.
The new library is better covered by tests and has been built from scratch as a general purpose file finder library.
The implementation is experimental and is hidden behind a finder build tag.
Warning
The io/fs based implementation (that used to be hidden behind a finder build tag) has been removed.
What's Changed
Exciting New Features 🎉
- Add NATS support by @hooksie1 in #1590
- Add slog support by @sagikazarmark in #1627
Enhancements 🚀
- chore: add local development environment using nix by @sagikazarmark in #1572
- feat: add func GetEnvPrefix by @baruchiro in #1565
- Improve dev env by @sagikazarmark in #1575
- fix: code optimization by @testwill in #1557
- test: remove not needed testutil.Setenv by @alexandear in #1610
- new finder library based on afero by @sagikazarmark in #1625
- refactor: make use of strings.Cutby @scop in #1650
Breaking Changes 🛠
- feat: drop support for Go 1.17 by @sagikazarmark in #1574
Dependency Updates ⬆️
- build(deps): bump mheap/github-action-required-labels from 4 to 5 by @dependabot in #1563
- build(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 by @dependabot in #1558
- build(deps): bump cachix/install-nix-action from 21 to 22 by @dependabot in #1573
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.8 to 2.0.9 by @dependabot in #1586
- chore: upgrade crypt by @sagikazarmark in #1589
- build(deps): bump actions/checkout from 3.5.3 to 4.0.0 by @dependabot in #1616
- build(deps): bump github/codeql-action from 2.21.2 to 2.21.5 by @dependabot in #1615
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.9 to 2.1.0 by @dependabot in #1614
- build(deps): bump actions/dependency-review-action from 3.0.6 to 3.0.8 by @dependabot in #1605
- build(deps): bump golangci/golangci-lint-action from 3.6.0 to 3.7.0 by @dependabot in #1604
- build(deps): bump actions/setup-go from 4.0.1 to 4.1.0 by @dependabot in #1593
- build(deps): bump github.com/subosito/gotenv from 1.4.2 to 1.6.0 by @dependabot in #1603
- build(deps): bump cachix/install-nix-action from 22 to 23 by @dependabot in #1620
- chore(deps): update crypt by @sagikazarmark in #1621
- build(deps): bump actions/dependency-review-action from 3.0.8 to 3.1.0 by @dependabot in #1623
- Bump minimum Go version to 1.19 by @sagikazarmark in #1626
- build(deps): bump github/codeql-action from 2.21.5 to 2.21.6 by @dependabot in #1632
- build(deps): bump github/codeql-action from 2.21.6 to 2.21.7 by @dependabot in #1634
- build(deps): bump actions/checkout from 4.0.0 to 4.1.0 by @dependabot in #1641
- build(deps): bump github.com/spf13/afero from 1.9.5 to 1.10.0 by @dependabot in #1640
- build(deps): bump github/codeql-action from 2.21.7 to 2.21.8 by @dependabot in #1638
- build(deps): bump github/codeql-action from 2.21.8 to 2.21.9 by @dependabot in #1648
- chore(deps): update crypt by @sagikazarmark in #1652
Other Changes
- [StepSecurity] ci: Harden GitHub Actions by @step-security-bot in #1592
- Add Vitess to list of projects using Viper by @systay in #1619
- docs: fix typos in comments by @alexandear in #1609
- ci: add Go 1.21 to the test matrix by @sagikazarmark in #1622
- Remove usages of deprecated io/ioutil; simplify viper tests by @alexandear in #1631
- chore: remove deprecated build tags by @alexandear in #1630
- refactor: replace 'interface{}' with 'any' by @alexandear in #1646
- test: refactor asserts by @alexandear in #1644
- docs: add set subset KV example by @yhliyr in #1647
- Make deps fixes by @bersace in #1628
New Contributors
- @goldeneggg made their first contribution in #1561
- @baruchiro made their first contribution in #1565
- @testwill made their first contribution in #1557
- @step-security-bot made their first contribution in #1592
- @systay made their first contribution in #1619
- @alexandear made their first contribution in #1609
- @hooksie1 made their first contribution in #1590
- @yhliyr made their first contribution in #1647
- @bersace made their first contribution in #1628
- @scop made their first contribution in #1650
Full Changelog: v1.16.0...v1.17.0
v1.16.0
What's Changed
Enhancements 🚀
- Sub parent inheritance by @TaylorOno in #1056
- fix: fix typo by @yquansah in #1523
- ci: add Go 1.20 to build matrix by @sagikazarmark in #1506
- extend v.find() to handle stringToInt value types with stringToInt pflag #1435 by @vorishirne in #1462
- add:viper: allow to disable internal log messages by @burgesQ in #1483
- Allow ConfigParseError to unwrap by @andig in #1433
Bug Fixes 🐛
- fix: time.Duration slice type conversion by @UrbanskiDawid in #1498
Dependency Updates ⬆️
- build(deps): bump mheap/github-action-required-labels from 3 to 4 by @dependabot in #1533
- build(deps): bump actions/setup-go from 3 to 4 by @dependabot in #1526
- build(deps): bump golang.org/x/net from 0.4.0 to 0.7.0 by @dependabot in #1519
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.6 to 2.0.7 by @dependabot in #1516
- build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 by @dependabot in #1515
- build(deps): bump github.com/spf13/afero from 1.9.3 to 1.9.5 by @dependabot in #1518
- build(deps): bump github.com/sagikazarmark/crypt from 0.9.0 to 0.10.0 by @dependabot in #1550
- build(deps): bump github.com/spf13/cast from 1.5.0 to 1.5.1 by @dependabot in #1551
- build(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3 by @dependabot in #1553
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.7 to 2.0.8 by @dependabot in #1555
Other Changes
- Update main image to better handle dark background by @Deleplace in #1532
New Contributors
- @UrbanskiDawid made their first contribution in #1498
- @TaylorOno made their first contribution in #1056
- @yquansah made their first contribution in #1523
- @Azanul made their first contribution in #1544
- @Deleplace made their first contribution in #1532
- @cfabianski made their first contribution in #1552
- @vorishirne made their first contribution in #1462
- @burgesQ made their first contribution in #1483
- @andig made their first contribution in #1433
Full Changelog: v1.15.0...v1.16.0
v1.15.0
What's Changed
Exciting New Features 🎉
Enhancements 🚀
- Add DocBlock to WatchConfig by @glebik000 in #1467
Breaking Changes 🛠
- Drop YAML v2 and TOML v1 by @sagikazarmark in #1493
- Drop support for Go 1.16 by @sagikazarmark in #1494
Dependency Updates ⬆️
- build(deps): bump github.com/spf13/afero from 1.9.2 to 1.9.3 by @dependabot in #1465
- build(deps): bump github.com/magiconair/properties from 1.8.6 to 1.8.7 by @dependabot in #1475
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.5 to 2.0.6 by @dependabot in #1466
- build(deps): bump mheap/github-action-required-labels from 2 to 3 by @dependabot in #1482
- build(deps): bump github.com/subosito/gotenv from 1.4.1 to 1.4.2 by @dependabot in #1488
- build(deps): bump github.com/sagikazarmark/crypt from 0.8.0 to 0.9.0 by @dependabot in #1490
New Contributors
- @choar816 made their first contribution in #1481
- @lol768 made their first contribution in #1485
- @MozartZ made their first contribution in #1464
- @glebik000 made their first contribution in #1467
Full Changelog: v1.14.0...v1.15.0
v1.14.0
What's Changed
Enhancements 🚀
- feat: make Viper compile on platforms unsupported by fsnotify by @sagikazarmark in #1457
- Fsnotify improvements by @sagikazarmark in #1458
- Disable watch on appengine by @sagikazarmark in #1460
Breaking Changes 🛠
- Drop support for Go 1.15 by @sagikazarmark in #1428
Dependency Updates ⬆️
- build(deps): bump github.com/spf13/afero from 1.8.2 to 1.9.2 by @dependabot in #1406
- build(deps): bump github.com/sagikazarmark/crypt from 0.6.0 to 0.7.0 by @dependabot in #1437
- build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #1453
- build(deps): bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0 by @dependabot in #1449
- chore: update crypt by @sagikazarmark in #1461
Full Changelog: v1.13.0...v1.14.0
v1.13.0
Important: This is the last release supporting Go 1.15.
What's Changed
Exciting New Features 🎉
- Add etcd3 to supported remote providers by @franklinkim in #1371
Enhancements 🚀
- Fix go-staticcheck failures (ST1005) by @mjmaisey in #1373
- Use jsonc in markdown codeblocks for better readability by @HurSungYun in #1393
- Add Go 1.19 support by @sagikazarmark in #1424
- Adds support for uint16 with GetUint16by @oxisto in #1405
- Add a DebugTo convenience funtion by @bcrochet in #1414
Bug Fixes 🐛
Dependency Updates ⬆️
- build(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2 by @dependabot in #1374
- build(deps): bump github.com/subosito/gotenv from 1.3.0 to 1.4.0 by @dependabot in #1375
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.1 to 2.0.2 by @dependabot in #1378
- build(deps): bump gopkg.in/yaml.v3 from 3.0.0 to 3.0.1 by @dependabot in #1360
- build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.3 by @dependabot in #1381
- build(deps): bump github.com/stretchr/testify from 1.7.3 to 1.7.4 by @dependabot in #1384
- build(deps): bump mheap/github-action-required-labels from 1 to 2 by @dependabot in #1383
- build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.8.0 by @dependabot in #1395
- build(deps): bump github.com/subosito/gotenv from 1.4.0 to 1.4.1 by @dependabot in #1420
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.2 to 2.0.5 by @dependabot in #1422
- build(deps): bump gopkg.in/ini.v1 from 1.66.4 to 1.67.0 by @dependabot in #1412
New Contributors
- @mjmaisey made their first contribution in #1373
- @HurSungYun made their first contribution in #1393
- @franklinkim made their first contribution in #1371
- @awrichar made their first contribution in #1387
- @oxisto made their first contribution in #1405
- @bcrochet made their first contribution in #1414
Full Changelog: v1.12.0...v1.13.0
v1.12.0
This release makes YAML v3 and TOML v2 the default versions used for encoding.
You can switch back to the old versions by adding viper_yaml2 and viper_toml1 to the build tags.
Please note that YAML v2 and TOML v1 are considered deprecated from this release and may be removed in a future release.
Please provide feedback in discussions and report bugs on the issue tracker. Thanks!
What's Changed
Exciting New Features 🎉
- Add etcd3 support to remote by @sagikazarmark in #1356
- Make YAML 3 the default by @sagikazarmark in #1357
- Make TOML 2 the default by @sagikazarmark in #1358
Enhancements 🚀
Dependency Updates ⬆️
- build(deps): bump github/codeql-action from 1 to 2 by @dependabot in #1336
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.0-beta.8 to 2.0.0 by @dependabot in #1339
- build(deps): bump github.com/mitchellh/mapstructure from 1.4.3 to 1.5.0 by @dependabot in #1332
- build(deps): bump github.com/pelletier/go-toml from 1.9.4 to 1.9.5 by @dependabot in #1335
- build(deps): bump github.com/fsnotify/fsnotify from 1.5.1 to 1.5.4 by @dependabot in #1338
- build(deps): bump github.com/spf13/cast from 1.4.1 to 1.5.0 by @dependabot in #1344
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.0 to 2.0.1 by @dependabot in #1343
- build(deps): bump github.com/subosito/gotenv from 1.2.0 to 1.3.0 by @dependabot in #1349
New Contributors
Full Changelog: v1.11.0...v1.12.0
v1.11.0
What's Changed
Exciting New Features 🎉
- Experimental yaml v3 library support by @sagikazarmark in #1273
- Experimental toml v2 support by @sagikazarmark in #1274
- Experimental logger by @sagikazarmark in #1275
Enhancements 🚀
- Remove unnecessary operand by @steviebps in #1213
- Improve encoding layer by @sagikazarmark in #1167
- Allow merging configs with different types of leaf values by @illarion in #1181
Bug Fixes 🐛
- Disable race detector on windows by @sagikazarmark in #1269
Breaking Changes 🛠
- Drop Go 1.14 support by @sagikazarmark in #1327
Dependency Updates ⬆️
- build(deps): bump github.com/spf13/afero from 1.6.0 to 1.7.0 by @dependabot in #1265
- build(deps): bump github.com/spf13/afero from 1.7.0 to 1.7.1 by @dependabot in #1271
- build(deps): bump github.com/spf13/afero from 1.7.1 to 1.8.0 by @dependabot in #1281
- build(deps): bump gopkg.in/ini.v1 from 1.66.2 to 1.66.3 by @dependabot in #1287
- build(deps): bump github.com/spf13/afero from 1.8.0 to 1.8.1 by @dependabot in #1291
- build(deps): bump actions/github-script from 5 to 6 by @dependabot in #1295
- build(deps): bump actions/checkout from 2 to 3 by @dependabot in #1304
- build(deps): bump github.com/magiconair/properties from 1.8.5 to 1.8.6 by @dependabot in #1299
- build(deps): bump gopkg.in/ini.v1 from 1.66.3 to 1.66.4 by @dependabot in #1293
- build(deps): bump github.com/spf13/afero from 1.8.1 to 1.8.2 by @dependabot in #1311
- build(deps): bump actions/setup-go from 2 to 3 by @dependabot in #1319
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.0-beta.6 to 2.0.0-beta.7 by @dependabot in #1320
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.0-beta.7 to 2.0.0-beta.8 by @dependabot in #1322
- Update crypt by @sagikazarmark in #1325
New Contributors
- @steviebps made their first contribution in #1213
- @illarion made their first contribution in #1181
Full Changelog: v1.10.1...v1.11.0
v1.10.1
This is a maintenance release upgrading the Consul dependency fixing CVEs.
v1.10.0
This is a maintenance release primarily containing minor fixes and improvements.
Changes
Added
- Experimental finder based on io/fs
- Tests are executed on Windows
- Tests are executed on Go 1.17
- Logger interface to decouple Viper from JWW
In addition to the above changes, this release comes with minor improvements, documentation changes an dependency updates.
Many thanks to everyone who contributed to this release!