github.com/caarlos0/env

env

A simple, zero-dependencies library to parse environment variables into structs

95

Decision Signals

Health score 95/100, confidence 100/100.

Excellent
Maintenance 95
Adoption 100
Security 92
Maturity 90
Developer DX 97
Confidence 100

Install

go get github.com/caarlos0/env

Package Data

updated Jun 11, 2026
Latest versionv3.5.0+incompatible
Imported by1.4K packages
Stars6.2K
Forks278
Last activity9 days ago
Latest releasev11.4.1 (1 months ago)
LicenseMIT
Known vuln records0

API Surface

8 symbols
SymbolKindSynopsis
CustomParsers Type type CustomParsers map[reflect.Type]ParserFunc
ParserFunc Type type ParserFunc func(v string) (interface{}, error)
ErrNotAStructPtr Variable var ErrNotAStructPtr = errors.New("Expected a pointer to a Struct")
ErrUnsupportedSliceType Variable var ErrUnsupportedSliceType = errors.New("Unsupported slice type")
ErrUnsupportedType Variable var ErrUnsupportedType = errors.New("Type is not supported")
OnEnvVarSet Variable var OnEnvVarSet func(reflect.StructField, string)
Parse Function func Parse(v interface{}) error
ParseWithFuncs Function func ParseWithFuncs(v interface{}, funcMap CustomParsers) error

Similar Packages

Go Configuration Libraries

#1 v2

Package config is a go config management implement.

Go Configuration Libraries 583 stars 215 imported-by 95% confidence
96

#2 Koanf

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

Go Configuration Libraries 4.1K stars 540 imported-by 100% confidence
95

#3 xdg

Package xdg provides an implementation of the XDG Base Directory Specification.

Go Configuration Libraries 1.0K stars 1.2K imported-by 100% confidence
93

#4 Viper

Go configuration with fangs.

Go Configuration Libraries 30.3K stars 0 imported-by 80% confidence
85

#5 cue

The home of the CUE language! Validate and define text-based and dynamic configuration

Go Configuration Libraries 6.1K stars 0 imported-by 40% confidence
83