# godotenv

> Loads environment variables from .env files in Go

Source: https://talira.ai/catalog/godotenv-1xnh3749
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [libraries / configuration](https://talira.ai/categories/libraries/configuration), [developer tools / environment / env vars](https://talira.ai/categories/developer-tools/environment/env-vars), [languages / go](https://talira.ai/categories/languages/go)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [John Barton](https://talira.ai/orgs/john-barton.md)

godotenv is a Go port of Ruby's dotenv: it loads environment variables from a `.env` file into the process environment, so configuration such as credentials and resource handles stays out of the code, twelve-factor style. Call `godotenv.Load()` at startup (or load specific files, or read them into a map without touching the environment), or use the `godotenv` command to run another program with a `.env` file's variables set. It's MIT-licensed and has CI on Linux and Windows.

## Links

- GitHub: https://github.com/joho/godotenv
- Docs: https://pkg.go.dev/github.com/joho/godotenv

## Problems it solves

- load settings from a .env file in my Go app during local development
- keep secrets like API keys out of my Go code and in environment variables
- run a command with the variables from a .env file set

## Features

- load .env files into the environment with godotenv.Load()
- load several named files, or read them into a map
- godotenv command to run a program with a .env file's variables
- MIT licence

## Trust

Overall: 0.42 out of 1.
Signals: maintenance 0.27, adoption 0.81, momentum 0.55, community 0.69, backing 0.30, extensibility 0.00.

- latest release v1.5.1 3.8 years ago
- 10.7k GitHub stars
- 51 contributors
- backed by John Barton

Warnings:

- last commit 6 months ago

## Alternatives

- [Viper](https://talira.ai/catalog/viper-mtps383e.md): Configuration for Go applications from files, environment variables, flags and remote stores

## Sources

[^1]: https://github.com/joho/godotenv/blob/main/LICENCE (checked 26 Nov 2026)
