From 7e8b45d7506d12305ce0fcaf8904a0f5fc8b1c35 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 14 Nov 2018 09:58:51 +0100 Subject: [PATCH] fix buildfile/reader to read last line (without NEWLINE) --- internal/buildfile/reader.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/buildfile/reader.go b/internal/buildfile/reader.go index 28c727d..c2811ba 100644 --- a/internal/buildfile/reader.go +++ b/internal/buildfile/reader.go @@ -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} }