package gotenv
Import Path
github.com/subosito/gotenv (on go.dev)
Dependency Relation
imports 6 packages, and imported by one package
Involved Source Files
Package gotenv provides functionality to dynamically load the environment variables
Package-Level Type Names (only one, which is exported)
Env holds key/value pair of valid environment variable
func Parse(r io.Reader) Env
func StrictParse(r io.Reader) (Env, error)
func checkFormat(s string, env Env) error
func parseExport(st string, env Env) error
func parseLine(s string, env Env) error
func parseVal(val string, env Env) string
func varReplacement(s string, hsq bool, env Env) string
Package-Level Functions (total 15, in which 7 are exported)
Apply is a function to load an io Reader then export the valid variables into environment variables if they do not exist.
Load is a function to load a file or multiple files and then export the valid variables into environment variables if they do not exist.
When it's called with no argument, it will load `.env` file on the current path and set the environment variables.
Otherwise, it will loop over the filenames parameter and set the proper environment variables.
Must is wrapper function that will panic when supplied function returns an error.
OverApply is a function to load an io Reader then export and override the valid variables into environment variables.
OverLoad is a function to load a file or multiple files and then export and override the valid variables into environment variables.
Parse is a function to parse line by line any io.Reader supplied and returns the valid Env key/value pair of valid variables.
It expands the value of a variable from the environment variable but does not set the value to the environment itself.
This function is skipping any invalid lines and only processing the valid one.
StrictParse is a function to parse line by line any io.Reader supplied and returns the valid Env key/value pair of valid variables.
It expands the value of a variable from the environment variable but does not set the value to the environment itself.
This function is returning an error if there are any invalid lines.
Package-Level Constants (total 2, neither is exported)
The pages are generated with Golds v0.3.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |