builder: several fixups from comments

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 305f73508022d0a3af65faa327aa798610969875
Component: engine
This commit is contained in:
Erik Hollensbe
2014-08-19 11:14:21 +00:00
parent 8812387cab
commit 4308bf42dd
6 changed files with 19 additions and 34 deletions

View File

@ -116,18 +116,16 @@ func parseJSON(rest string) (*Node, map[string]bool, error) {
func parseMaybeJSON(rest string) (*Node, map[string]bool, error) {
rest = strings.TrimSpace(rest)
if strings.HasPrefix(rest, "[") {
node, attrs, err := parseJSON(rest)
node, attrs, err := parseJSON(rest)
if err == nil {
return node, attrs, nil
}
if err == errDockerfileJSONNesting {
return nil, nil, err
}
if err == nil {
return node, attrs, nil
}
if err == errDockerfileJSONNesting {
return nil, nil, err
}
node := &Node{}
node = &Node{}
node.Value = rest
return node, nil, nil
}

View File

@ -100,8 +100,7 @@ func Parse(rwc io.Reader) (*Node, error) {
}
if line != "" && child == nil {
for {
scanner.Scan()
for scanner.Scan() {
newline := strings.TrimSpace(scanner.Text())
if newline == "" {