osutil

package
v0.0.0-...-5fe729b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 1 Imported by: 11

Documentation

Overview

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

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environ

type Environ []string

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

Example
package main

import (
	"os"
	"os/exec"

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

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

func (*Environ) Set

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

Set environment variable key to value.

func (*Environ) Unset

func (e *Environ) Unset(key string)

Unset environment variable key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL