dotenv

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package dotenv reads env files in the Compose Specification's format (container_spec.md, "Env_file format"): `VAR=VAL` lines, `#` comments, unquoted and double-quoted values interpolated, single-quoted values literal, `\` escapes, an optional `export ` prefix; a line with a bare `VAR` takes VAR from the lookup, or leaves it unset.

The quoting and escape rules follow compose-go's dotenv parser, the reference implementation the specification points to.

Index

Constants

View Source
const MaxBytes = 1 << 20

MaxBytes is the largest env file read (1 MiB).

Variables

This section is empty.

Functions

This section is empty.

Types

type Var

type Var struct {
	Name, Value string
}

Var is one variable, in file order.

func Parse

func Parse(src string, lookup interp.Lookup, raw bool) ([]Var, error)

Parse reads src. Values are interpolated against the variables defined above them, then lookup (lookup wins, as the project environment does over a .env file); raw disables interpolation (`format: raw`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL