envconfig is a Go configuration decoder and environment variable mapper that deserializes environment variables into structured Go data types. It provides tools for validating mandatory fields and ensuring application configuration adheres to the external configuration patterns of twelve-factor app compliance. The library features a help generator that creates formatted usage text based on struct definitions to describe expected environment variables. It also includes a validation tool capable of detecting unused environment variables that match a specific prefix but do not correspond to any
Kong is a declarative command line interface framework and parser for Go. It maps flags and positional arguments directly into typed Go structures using struct tags, allowing developers to define terminal interfaces through data models rather than manual parsing logic. The project functions as a configuration mapper that populates Go structures from a combination of command-line arguments, environment variables, and JSON files. It distinguishes itself by providing a dependency injection container to pass external services into command handlers and a plugin architecture for dynamic command reg
koanf is a configuration management library for Go designed to load, merge, and unmarshal application settings from multiple sources into structured objects. It functions as a multi-source config loader that aggregates data from environment variables, files, and remote providers into a single unified map. The system utilizes a pluggable architecture for parsing and data abstraction, allowing it to transform bytes from formats such as JSON, YAML, and TOML into nested maps. It supports dynamic configuration watching to monitor external sources and trigger automatic reloads when settings change.
env is a Go library that reads environment variables and populates the fields of a Go struct according to tag directives. It uses reflection to iterate over struct types and tags at runtime, mapping environment variable names to struct fields and applying parsing behavior defined in struct tags. The library supports required field validation, returning errors when marked fields are missing or empty after parsing. It also provides default value fallback from struct tags when environment variables are not set, environment variable expansion that recursively substitutes references within values,
mapstructure is a reflection-based library for the bidirectional encoding and decoding of generic map data into native typed Go structures. It functions as a tool for transforming loosely typed map values into specific structs and encoding those structs back into maps.
The main features of mitchellh/mapstructure are: Reflection-Based Map Mapping, Hash-to-Struct Hydrators, Dynamic Data Mapping, Generic Map Transformations, Struct Mapping, Map-to-Struct Decoders, Struct-to-Map Encoders, Go Data Mapping Libraries.
Open-source alternatives to mitchellh/mapstructure include: kelseyhightower/envconfig — envconfig is a Go configuration decoder and environment variable mapper that deserializes environment variables into… alecthomas/kong — Kong is a declarative command line interface framework and parser for Go. It maps flags and positional arguments… knadh/koanf — koanf is a configuration management library for Go designed to load, merge, and unmarshal application settings from… caarlos0/env — env is a Go library that reads environment variables and populates the fields of a Go struct according to tag… go-validator/validator — This project is a data validation framework for the Go programming language that enforces integrity by applying… lightbend/config — This is a configuration library for JVM applications that parses HOCON, JSON, and Java properties files into an…