Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
| ... | ... |
@@ -98,11 +98,12 @@ func Parse(rwc io.Reader) (*Node, error) {
|
| 98 | 98 |
scanner := bufio.NewScanner(rwc) |
| 99 | 99 |
|
| 100 | 100 |
for scanner.Scan() {
|
| 101 |
- if scanner.Text() == "" {
|
|
| 101 |
+ scannedLine := strings.TrimLeftFunc(scanner.Text(), unicode.IsSpace) |
|
| 102 |
+ if stripComments(scannedLine) == "" {
|
|
| 102 | 103 |
continue |
| 103 | 104 |
} |
| 104 | 105 |
|
| 105 |
- line, child, err := parseLine(strings.TrimLeftFunc(scanner.Text(), unicode.IsSpace)) |
|
| 106 |
+ line, child, err := parseLine(scannedLine) |
|
| 106 | 107 |
if err != nil {
|
| 107 | 108 |
return nil, err |
| 108 | 109 |
} |
| ... | ... |
@@ -111,7 +112,7 @@ func Parse(rwc io.Reader) (*Node, error) {
|
| 111 | 111 |
for scanner.Scan() {
|
| 112 | 112 |
newline := scanner.Text() |
| 113 | 113 |
|
| 114 |
- if newline == "" {
|
|
| 114 |
+ if stripComments(strings.TrimSpace(newline)) == "" {
|
|
| 115 | 115 |
continue |
| 116 | 116 |
} |
| 117 | 117 |
|