finds.dev← search

// the find

knadh/koanf

★ 4,212 · Go · MIT · updated Sep 2026

Simple, extremely lightweight, extensible, configuration management library for Go. Supports JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.

koanf is a modular Go configuration library that loads and merges config from files, env vars, flags, and remote sources like S3, Vault, Consul, and etcd into a queryable key-value store. It's aimed at Go developers who've hit viper's dependency bloat or its key-lowercasing bug and want something smaller with cleaner abstractions.

The Provider/Parser split is genuinely well designed — the core module has zero format or source dependencies, and each provider (S3, Vault, etcd...) ships as its own go.mod so you only pull in what you use. It doesn't lowercase keys, which is a real bug in viper that breaks case-sensitive JSON/YAML specs. Watch() support on file, vault, consul, and appconfig providers gives you live-reload without needing a separate polling loop. Flat-path unmarshaling (UnmarshalConf.FlatPaths) is a nice touch for pulling deeply nested keys into a flat struct without writing intermediate types.

There's no schema or required-field validation — a missing key just silently returns a zero value from Get(), so typos in config paths fail quietly instead of at startup. The docs admit Watch() isn't goroutine-safe against concurrent Get() calls, meaning anyone doing live reload has to hand-roll their own mutex. Default merge behavior across parsers can silently change a value's type (JSON's float64 vs YAML's int for the same field), and the docs concede StrictMerge can still fail on legitimate cross-parser type differences, so it's not a clean fix. Because every provider is a separate module, mixing several sources (say file + env + S3) means tracking several go.sum entries instead of one dependency tree.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →