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:
@ -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
|
||||
}
|
||||
|
||||
@ -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 == "" {
|
||||
|
||||
Reference in New Issue
Block a user