go: github.com/shurcooL/go/osutil Index | Examples | Files

package osutil

import "github.com/shurcooL/go/osutil"

Package osutil offers a utility for manipulating a set of environment variables.

Index

Examples

Package Files

environ.go

type Environ Uses

type Environ []string

Environ is a slice of strings representing the environment, in the form "key=value".

Code:

cmd := exec.Command("example")
env := osutil.Environ(os.Environ())
env.Set("USER", "gopher")
env.Set("HOME", "/usr/gopher")
env.Unset("TMPDIR")
cmd.Env = env

func (*Environ) Set Uses

func (e *Environ) Set(key, value string)

Set environment variable key to value.

func (*Environ) Unset Uses

func (e *Environ) Unset(key string)

Unset environment variable key.

Package osutil imports 1 packages (graph) and is imported by 2 packages. Updated 2017-06-27. Refresh now. Tools for package owners.