Skip to content

herzrasen/go-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-env

Tired of writing the same env helpers over and over again? Yeah. me too. That's why this repo exists.

Installation

go get github.com/herzrasen/go-env

Usage

To get an error when no environment variable key exists:

import "github.com/herzrasen/go-env/env"

v, err := env.GetOrError("FOO")
if err != nil {
	return err
}
fmt.Printf("%s", v)

To either load the environment variable or use a default value:

import "github.com/herzrasen/go-env/env"

v := env.GetOrElse("FOO", "baz")
fmt.Printf("%s", v)

About

A simple env helper for golang projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published