line continuation regex

This commit is contained in:
Jason McVetta 2013-09-09 17:02:45 -07:00
parent 6921ca4813
commit ebb934c1b0
1 changed files with 3 additions and 2 deletions

View File

@ -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')