// the find
kelseyhightower/envconfig
Golang library for managing configuration data from environment variables
A Go library that maps environment variables to struct fields via reflection. You define a config struct, call Process(), and it does the rest — type conversion, defaults, required-field enforcement. Aimed at any Go service that follows 12-factor config.
Handles the tedious cases correctly out of the box: time.Duration parsing, slice splitting, map decoding, and TextUnmarshaler/BinaryUnmarshaler for custom types. The custom Decoder interface is a clean escape hatch when the built-in parsing isn't enough. struct tags are minimal and readable — `required:"true"` and `default:"foobar"` are self-documenting. The codebase is tiny and stable; 5400 stars on ~400 lines means the surface area is well understood.
Required-but-empty variables pass validation — `MYAPP_REQUIREDVAR=` silently succeeds, which bites you when an orchestrator injects an empty string instead of omitting the var. No built-in support for validation beyond presence (no range checks, no enum validation). The `split_words` number-globbing behavior (numbers attach to the previous word) is a footgun documented only in the README, not in a compile-time error or warning. No schema export or documentation generation — you can't auto-generate a `.env.example` from the struct, so documentation tends to drift.