env

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package env provides environment variable loading from .env files. It offers a pure Go implementation without external dependencies.

Key features:

  • .env file parsing
  • Non-override behavior (existing env vars take precedence)
  • Comment and empty line support
  • Quote handling for values
  • Helper functions for retrieving values with defaults

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key, defaultValue string) string

Get retrieves an environment variable value. It first checks the process environment, then falls back to the default value.

func Load

func Load(filepath string) (int, error)

Load reads environment variables from a .env file and sets them in the process environment. It does NOT override existing environment variables. Returns the number of variables loaded.

func MustGet

func MustGet(key string) string

MustGet retrieves an environment variable value. It panics if the variable is not set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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