Documentation
¶
Overview ¶
Package envparse is a minimal environment variable parser. It handles empty lines, comments, single quotes, double quotes, and JSON escape sequences.
Non-empty or comment lines should be of the form:
KEY=value
While extraneous characters are discouraged, an "export" prefix, preceding whitespace, and trailing whitespace are all removed:
KEY = This is ok! # Parses to {"KEY": "This is ok!"} KEY2= Also ok. # Parses to {"KEY2": "Also ok."} export FOO=bar # Parses to {"FOO": "bar"}
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingSeparator = fmt.Errorf("missing =") ErrEmptyKey = fmt.Errorf("empty key") ErrUnmatchedDouble = fmt.Errorf(`unmatched "`) ErrUnmatchedSingle = fmt.Errorf("unmatched '") ErrIncompleteEscape = fmt.Errorf("incomplete escape sequence") ErrIncompleteHex = fmt.Errorf("incomplete hex sequence") ErrIncompleteSur = fmt.Errorf("incomplete Unicode surrogate pair") ErrMultibyteEscape = fmt.Errorf("multibyte characters disallowed in escape sequences") )
Functions ¶
Types ¶
type ParseError ¶
ParseError is returned whenever the Parse function encounters an error. It includes the line number and underlying error.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Click to show internal directories.
Click to hide internal directories.