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
|
||||
l, reader := 0, bufio.NewReader(buildfile)
|
||||
eof := false
|
||||
for {
|
||||
if eof {
|
||||
break
|
||||
}
|
||||
|
||||
l++
|
||||
|
||||
// read line until end
|
||||
line, err := reader.ReadString('\n')
|
||||
if err == io.EOF {
|
||||
break
|
||||
if len(line) > 0 {
|
||||
eof = true
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else if err != nil {
|
||||
return nil, LineError{l, err}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue