fix buildfile/reader to read last line (without NEWLINE)
This commit is contained in:
parent
361c3f6c25
commit
7e8b45d750
|
@ -37,13 +37,22 @@ func NewReader(ctx *instruction.ExecutionContext, buildfile io.Reader) (*Reader,
|
||||||
|
|
||||||
// add each line as instruction
|
// add each line as instruction
|
||||||
l, reader := 0, bufio.NewReader(buildfile)
|
l, reader := 0, bufio.NewReader(buildfile)
|
||||||
|
eof := false
|
||||||
for {
|
for {
|
||||||
|
if eof {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
l++
|
l++
|
||||||
|
|
||||||
// read line until end
|
// read line until end
|
||||||
line, err := reader.ReadString('\n')
|
line, err := reader.ReadString('\n')
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
if len(line) > 0 {
|
||||||
|
eof = true
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return nil, LineError{l, err}
|
return nil, LineError{l, err}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue