const operator … const referenceOpener … const referenceCloser … // syntaxWrap returns the input string wrapped by the expansion syntax. func syntaxWrap(input string) string { … } // MappingFuncFor returns a mapping function for use with Expand that // implements the expansion semantics defined in the expansion spec; it // returns the input string wrapped in the expansion syntax if no mapping // for the input is found. func MappingFuncFor(context ...map[string]string) func(string) string { … } // Expand replaces variable references in the input string according to // the expansion spec using the given mapping function to resolve the // values of variables. func Expand(input string, mapping func(string) string) string { … } // tryReadVariableName attempts to read a variable name from the input // string and returns the content read from the input, whether that content // represents a variable name to perform mapping on, and the number of bytes // consumed in the input string. // // The input string is assumed not to contain the initial operator. func tryReadVariableName(input string) (string, bool, int) { … }