mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Allow multiple tab/spaces between instructions and arguments
This commit is contained in:
parent
2cc22de696
commit
b103ac70bf
1 changed files with 5 additions and 5 deletions
10
buildfile.go
10
buildfile.go
|
@ -124,8 +124,8 @@ func (b *buildFile) CmdEnv(args string) error {
|
||||||
if len(tmp) != 2 {
|
if len(tmp) != 2 {
|
||||||
return fmt.Errorf("Invalid ENV format")
|
return fmt.Errorf("Invalid ENV format")
|
||||||
}
|
}
|
||||||
key := strings.Trim(tmp[0], " ")
|
key := strings.Trim(tmp[0], " \t")
|
||||||
value := strings.Trim(tmp[1], " ")
|
value := strings.Trim(tmp[1], " \t")
|
||||||
|
|
||||||
for i, elem := range b.config.Env {
|
for i, elem := range b.config.Env {
|
||||||
if strings.HasPrefix(elem, key+"=") {
|
if strings.HasPrefix(elem, key+"=") {
|
||||||
|
@ -215,8 +215,8 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||||
if len(tmp) != 2 {
|
if len(tmp) != 2 {
|
||||||
return fmt.Errorf("Invalid ADD format")
|
return fmt.Errorf("Invalid ADD format")
|
||||||
}
|
}
|
||||||
orig := strings.Trim(tmp[0], " ")
|
orig := strings.Trim(tmp[0], " \t")
|
||||||
dest := strings.Trim(tmp[1], " ")
|
dest := strings.Trim(tmp[1], " \t")
|
||||||
|
|
||||||
cmd := b.config.Cmd
|
cmd := b.config.Cmd
|
||||||
b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", orig, dest)}
|
b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", orig, dest)}
|
||||||
|
@ -344,7 +344,7 @@ func (b *buildFile) Build(dockerfile, context io.Reader) (string, error) {
|
||||||
}
|
}
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
line = strings.TrimSpace(strings.Replace(line, " ", " ", -1))
|
line = strings.Trim(strings.Replace(line, "\t", " ", -1), " \t\r\n")
|
||||||
// Skip comments and empty line
|
// Skip comments and empty line
|
||||||
if len(line) == 0 || line[0] == '#' {
|
if len(line) == 0 || line[0] == '#' {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue