Skip to content
masterclass Buddy

Go · Function

os.Getenv

gotenv loads variables from .env files or readers into Go's process environment. It can preserve existing values or override them.

Last updated

Syntax

gotenv.Load(filenames ...string) error
gotenv.Apply(reader io.Reader) error
gotenv.OverLoad(filenames ...string) error
gotenv.OverApply(reader io.Reader) error
gotenv.Must(loader func(...string) error, filenames ...string)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Load
  • Apply
  • OverLoad
  • OverApply
  • Must
  • os.Getenv

Source: gotenv package - github.com/subosito/gotenv - Go Packages. Checked 2026-11-03.