- Go 100%
| internal | ||
| get.go | ||
| getelse.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| mustget.go | ||
| README.md | ||
| type.go | ||
| vars.go | ||
go-env
Package env provides tools for working with environment-variables, for the Go programming language.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-env
Examples
Here is an example of getting the value of the environment-variable PORT as a uint16:
tcpport, found := env.Get[uint16]("PORT")
Here is an example of getting the value of the environment-variable PORT as a uint16,
and it doesn't exist or isn't a uint16 number, then defaulting it to 8080:
tcpport := env.GetElse[uint16]("PORT", 8080)
Here is an example of getting the value of the environment-variable SHELL as a string:
shell, found := env.Get[string]("SHELL")
Import
To import package env use import code like the following:
import "github.com/reiver/go-env"
Installation
To install package env do the following:
GOPROXY=direct go get github.com/reiver/go-env
Author
Package env was written by Charles Iliya Krempeaux