Documentation
¶
Overview ¶
Package environment supports environment variable format conversion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromMap ¶
FromMap converts a map of environment variables into a slice of "KEY=value" strings. If the provided environment is nil, then the resulting slice will be nil. If the provided environment is non-nil but empty, then the resulting slice will be empty. These two properties are critical to usage with the os/exec package.
func ParseBlock ¶
ParseBlock parses an environment variable block of the form VAR1=value1[\r]\nVAR2=value2[\r]\n... into a slice of KEY=value strings. It opts for performance over extensive format validation.
func ToMap ¶
ToMap converts an environment variable specification from a slice of "KEY=value" strings to a map with equivalent contents. Any entries not adhering to the specified format are ignored. Entries are processed in order, meaning that the last entry seen for a key will be what populates the map.
Types ¶
This section is empty.