joho/godotenv

A Go port of Ruby's dotenv library (Loads environment variables from .env files)

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 51 seconds ago
Added to GitGenius on September 5th, 2026
Created on July 30th, 2013
Open Issues & Pull Requests: 81 (+0)
GitHub issues: Enabled
Number of forks: 460
Total Stargazers: 10,613 (+0)
Total Subscribers: 46 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

godotenv is a Go library that loads environment variables from .env files, ported from Ruby's dotenv project.

The tool solves the problem of managing environment-specific configuration during development and testing without hardcoding values or manually setting environment variables on each machine. It reads a .env file in your project and populates environment variables from it. The library supports multiple usage patterns: as an imported package in your Go application, as an autoload mechanism that activates on import, or as a command-line tool. It handles various .env file formats including comments, exports, and YAML-style syntax, and can return configuration as a map instead of modifying the environment if preferred.

Developers should choose this tool if they follow twelve-factor app principles and need straightforward .env file parsing in Go projects. It suits any Go application where configuration varies between development, testing, and production environments. The tool respects existing environment variables by default, treating them as higher precedence than loaded values, though an overload mode is available to reverse this. One compatibility note: godotenv permits hyphens in variable names (matching Node's dotenv), whereas Ruby's dotenv does not.

The project is declared feature complete and does not accept pull requests for new functionality or API changes. Contributions are welcomed only for bug fixes, documentation improvements, and maintenance work. The tool maintains test coverage across Linux and Windows environments, though the command-line version carries no guarantees on Windows.