finds.dev← search

// the find

kelseyhightower/envconfig

★ 5,454 · Go · MIT · updated Jun 2025

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.

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 →