Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 593 Bytes

README.md

File metadata and controls

36 lines (24 loc) · 593 Bytes

venv

GoDoc

This is a Go library to abstract access to environment variables.
Like [spf13/afero][afero] or [blang/vfs][vfs], but for the env.

Usage

package main

import (
	"fmt"
	"github.com/georgettica/venv"
)

func main() {
	var e venv.Env

	// Use the real environment

	e = venv.OS()
	fmt.Printf("Hello, %s!\n", e.Getenv("USER"))

	// Or use a mock

	e = venv.Mock()
	e.Setenv("USER", "fred")
	fmt.Printf("Hello, %s!\n", e.Getenv("USER"))
}

License

MIT.