osx

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

Functions that extend the capability of the os package.

It turns out to be very handy to have the capability to set environment variables on a temporary basis and subsequently revert them. Also, it turns out that pretty much no tests check whether the Setenv has actually succeeded.

Documentation

Overview

Package osx provides functionx which are extensions of the functionality provided in os.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustSetenv

func MustSetenv(key, value string) func()

MustSetenv sets the environment variable named key to the passed-in value. Returns a function that, when run, restores the environment to its previous state.

Example
package main

import (
	"github.com/m-lab/go/osx"
)

func main() {
	revert := osx.MustSetenv("PATH", "/temp/bin")
	defer revert()
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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