Skip to content

Commit bcc3c98

Browse files
committed
parser: avoid expensive heredocs evaluations early
Atm every line needs to be fully evaluated while it is unlikely that a random line happens to be a heredoc. Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 47ec27c commit bcc3c98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/dockerfile/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func Parse(rwc io.Reader) (*Result, error) {
347347
return nil, withLocation(err, startLine, currentLine)
348348
}
349349

350-
if child.canContainHeredoc() {
350+
if child.canContainHeredoc() && strings.Contains(line, "<<") {
351351
heredocs, err := heredocsFromLine(line)
352352
if err != nil {
353353
return nil, withLocation(err, startLine, currentLine)

0 commit comments

Comments
 (0)