z-go-env-v11

Installation
SKILL.md

caarlos0/env v11

Bind environment variables to a config struct. env/v11 does parsing and presence checks; keep business rules and enum membership in a separate Validate().

Parse entry points

Prefer the generic forms — they return the value, no pre-zeroed pointer:

cfg, err := env.ParseAs[Config]()                       // from os.Environ()
cfg, err := env.ParseAsWithOptions[Config](env.Options{ // custom source/options
    Environment: m,
})
cfg := env.Must(env.ParseAs[Config]())                  // panic on error (main only)

Pointer forms env.Parse(&cfg) / env.ParseWithOptions(&cfg, opts) exist for when you already hold a struct (e.g. partially pre-filled).

Installs
13
First Seen
Jul 2, 2026