genv

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 3 Imported by: 38

Documentation

Overview

Package genv provides operations for environment variables of system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() []string

All returns a copy of strings representing the environment, in the form "key=value".

func Build

func Build(m map[string]string) []string

Build builds a map to a environment variable slice.

func Contains

func Contains(key string) bool

Contains checks whether the environment variable named <key> exists.

func Get

func Get(key string, def ...string) string

Get returns the value of the environment variable named by the <key>. It returns given <def> if the variable does not exist in the environment.

func GetVar added in v1.12.2

func GetVar(key string, def ...interface{}) *gvar.Var

GetVar creates and returns a Var with the value of the environment variable named by the <key>. It uses the given <def> if the variable does not exist in the environment.

func Map

func Map() map[string]string

Map returns a copy of strings representing the environment as a map.

func Remove

func Remove(key ...string) error

Remove deletes one or more environment variables.

func Set

func Set(key, value string) error

Set sets the value of the environment variable named by the <key>. It returns an error, if any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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