nasermirzaei89/env
LibraryLive in productionGolang Get Environment Variables Package
Golang Get Environment Variables Package with Zero Dependencies
- Go100.0%
1 Review
nasermirzaei89/env is a small Go package with a very simple purpose: make reading environment variables less repetitive. Instead of scattering os.Getenv, parsing, defaults, and “must be set” checks across an app, it gives helpers like GetBool, GetFloat, GetInt, GetString, and MustGetString, with newer releases adding generic Get and MustGet functions. That is a narrow problem, but it is a real one in Go services where config often comes from environment variables.
The strongest thing about the project is its simplicity. The README examples are easy to understand, the install command is just go get github.com/nasermirzaei89/env, and the package appears to avoid becoming a full config framework. That makes it useful for smaller apps, CLIs, workers, or services that do not need struct-tag loading, config files, validation layers, or a larger dependency tree. The recent changelog also shows some care for keeping the package lean, including removing testify in v1.7.0.
The tradeoff is that the project needs sharper positioning. Go already has a lot of environment/config packages, from tiny helpers to full struct loaders like caarlos0/env or kelseyhightower/envconfig. This package should make its intended use case very explicit: “typed env helpers with defaults and must-get behavior, not a config loader.” I would also expand the README with a complete API table, examples for parse failures, behavior when a value is empty, supported generic types, and guidance on when to use MustGet versus returning errors.
The project also looks modest in community footprint, with LibHunt showing roughly a few dozen stars and low fork count. That is fine for a small utility, but it means documentation and tests matter even more. Overall, this is a clean little package for reducing env-var boilerplate, and it would feel more production-ready with fuller behavior docs, visible test/CI badges, and a clearer comparison against heavier config libraries.
