Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/go-env
Go wrapper around os.Getenv() that returns an error instead of empty string
https://github.com/segment-boneyard/go-env
Last synced: about 5 hours ago
JSON representation
Go wrapper around os.Getenv() that returns an error instead of empty string
- Host: GitHub
- URL: https://github.com/segment-boneyard/go-env
- Owner: segment-boneyard
- Created: 2014-09-08T20:04:34.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-18T15:56:50.000Z (over 9 years ago)
- Last Synced: 2024-06-19T23:27:38.427Z (5 months ago)
- Language: Go
- Size: 132 KB
- Stars: 21
- Watchers: 46
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# go-env
[![Build Status](https://travis-ci.org/segmentio/go-env.svg?branch=master)](https://travis-ci.org/segmentio/go-env)
Tiny wrapper around getenv() to return an error instead of an empty string when missing.
## Usage
#### func Get
```go
func Get(name string) (string, error)
```
Get env var `name` or return an error if it's missing.#### func GetDefault
```go
func GetDefault(name string, value string) string
```
GetDefault returns `value` if environment variable `name` is not present.#### func MustGet
```go
func MustGet(name string) string
```
MustGet panics if the environment variable is missing.# License
MIT