From b103ac70bfb9f9419d4487bf969b0f244b260014 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 10 Jun 2013 09:31:59 -0700 Subject: [PATCH] Allow multiple tab/spaces between instructions and arguments --- buildfile.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildfile.go b/buildfile.go index 6ed0276bec..b38101c72b 100644 --- a/buildfile.go +++ b/buildfile.go @@ -124,8 +124,8 @@ func (b *buildFile) CmdEnv(args string) error { if len(tmp) != 2 { return fmt.Errorf("Invalid ENV format") } - key := strings.Trim(tmp[0], " ") - value := strings.Trim(tmp[1], " ") + key := strings.Trim(tmp[0], " \t") + value := strings.Trim(tmp[1], " \t") for i, elem := range b.config.Env { if strings.HasPrefix(elem, key+"=") { @@ -215,8 +215,8 @@ func (b *buildFile) CmdAdd(args string) error { if len(tmp) != 2 { return fmt.Errorf("Invalid ADD format") } - orig := strings.Trim(tmp[0], " ") - dest := strings.Trim(tmp[1], " ") + orig := strings.Trim(tmp[0], " \t") + dest := strings.Trim(tmp[1], " \t") cmd := b.config.Cmd 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 } - line = strings.TrimSpace(strings.Replace(line, " ", " ", -1)) + line = strings.Trim(strings.Replace(line, "\t", " ", -1), " \t\r\n") // Skip comments and empty line if len(line) == 0 || line[0] == '#' { continue