From ebb934c1b044f4bbffe312e9c88c00134c94ef7f Mon Sep 17 00:00:00 2001 From: Jason McVetta Date: Mon, 9 Sep 2013 17:02:45 -0700 Subject: [PATCH] line continuation regex --- buildfile.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildfile.go b/buildfile.go index 5472b84982..c40ee5f063 100644 --- a/buildfile.go +++ b/buildfile.go @@ -458,7 +458,8 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error { return nil } -var multilineRegex = regexp.MustCompile("\\.*\n") +// Long lines can be split with a backslash +var lineContinuation = regexp.MustCompile(`\s*\\.*\n`) func (b *buildFile) Build(context io.Reader) (string, error) { // FIXME: @creack any reason for using /tmp instead of ""? @@ -481,7 +482,7 @@ func (b *buildFile) Build(context io.Reader) (string, error) { return "", err } dockerfile := string(fileBytes) - // dockerfile = multilineRegex.ReplaceAllString(dockerfile, " ") + dockerfile = lineContinuation.ReplaceAllString(dockerfile, " ") stepN := 0 for _, line := range strings.Split(dockerfile, "\n") { /* line, err := dockerfile.ReadString('\n')