finds.dev

spf13/viper

Go configuration with fangs

View on GitHub

★ 30,342GoMITupdated Jan 2026

// the take

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.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
30,342
Forks
2,102
Language
Go
License
MIT
Last commit
12 Jan 2026

// nearby

If viper isn't quite it.

All repos →