mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: update buildkit to v0.19.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
15
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/directives.go
generated
vendored
15
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/directives.go
generated
vendored
@ -112,10 +112,15 @@ func (d *DirectiveParser) ParseAll(data []byte) ([]*Directive, error) {
|
||||
// This allows for a flexible range of input formats, and appropriate syntax
|
||||
// selection.
|
||||
func DetectSyntax(dt []byte) (string, string, []Range, bool) {
|
||||
return ParseDirective(keySyntax, dt)
|
||||
return parseDirective(keySyntax, dt, true)
|
||||
}
|
||||
|
||||
func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
|
||||
return parseDirective(key, dt, false)
|
||||
}
|
||||
|
||||
func parseDirective(key string, dt []byte, anyFormat bool) (string, string, []Range, bool) {
|
||||
dt = discardBOM(dt)
|
||||
dt, hadShebang, err := discardShebang(dt)
|
||||
if err != nil {
|
||||
return "", "", nil, false
|
||||
@ -131,6 +136,10 @@ func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
|
||||
return syntax, cmdline, loc, true
|
||||
}
|
||||
|
||||
if !anyFormat {
|
||||
return "", "", nil, false
|
||||
}
|
||||
|
||||
// use directive with different comment prefix, and search for //key=
|
||||
directiveParser = DirectiveParser{line: line}
|
||||
directiveParser.setComment("//")
|
||||
@ -171,3 +180,7 @@ func discardShebang(dt []byte) ([]byte, bool, error) {
|
||||
}
|
||||
return dt, false, nil
|
||||
}
|
||||
|
||||
func discardBOM(dt []byte) []byte {
|
||||
return bytes.TrimPrefix(dt, []byte{0xEF, 0xBB, 0xBF})
|
||||
}
|
||||
|
Reference in New Issue
Block a user