Documentation
¶
Overview ¶
Package expand substitutes variables in Containerfile words the way the Dockerfile reference's "Environment replacement" section specifies, with the grammar of BuildKit's frontend/dockerfile/shell lexer: single and double quotes, the escape token, $name and ${name}, and the modifiers ${name:-word} ${name-word} ${name:+word} ${name+word} ${name?word} ${name:?word} ${name#pattern} ${name##pattern} ${name%pattern} ${name%%pattern} ${name/pattern/repl} ${name//pattern/repl}.
Nothing is ever executed: there is no command substitution, no arithmetic, no globbing of the file system. A value is inserted as data and never re-scanned, so a variable cannot inject syntax. The output and the nesting of ${...} are bounded.
Index ¶
Constants ¶
const ( // MaxOutput is the largest result of one word, in bytes. MaxOutput = 1 << 20 // MaxDepth is the deepest nesting of ${...}. MaxDepth = 32 )
Limits of one expansion.
Variables ¶
var ErrTooLong = errors.New("expansion exceeds 1 MiB")
ErrTooLong reports an expansion beyond MaxOutput.
Functions ¶
This section is empty.