// the find
spf13/viper
Go configuration with fangs
Viper is the de facto configuration library for Go CLI tools — if you're using Cobra, you're probably already using Viper. It merges config files, environment variables, flags, and remote stores (etcd, Consul) into one interface with a clear precedence order. Most Go developers writing anything more than a toy CLI will hit the same problems Viper solves.
The precedence chain (explicit Set > flags > env > file > remote > defaults) is sensible and well-documented, so you're not guessing which value wins. Config file watching via fsnotify works in production — Hugo relies on it. The `Sub()` method for extracting config subsets is genuinely useful for modular app design. Remote provider support (etcd, Consul, Firestore) with optional GPG encryption is a real differentiator from simpler alternatives.
All keys are case-insensitive and that's not going to change before v2 — if your env vars and config file keys have collisions that depend on case, you're stuck. The global singleton is officially discouraged in the docs but still the first thing every tutorial reaches for, which makes testing a pain in practice. No deep merge on complex values — override a nested map and the whole subtree gets replaced, which surprises everyone at least once. Concurrent reads and writes require you to add your own sync; the library does nothing to protect you, and the error is a panic not a clear message.