From e6563fbd8bdbe6243185089e23c5c0d5a628a1e8 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 2 Apr 2022 20:59:55 -0400 Subject: [PATCH] fix: add newline at the beginning of file buffer when there is shebang this makes the line count in error messages line up properly --- util/util.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/util.go b/util/util.go index d345d1b..5fdaad3 100644 --- a/util/util.go +++ b/util/util.go @@ -71,15 +71,16 @@ func DoFile(rtm *rt.Runtime, path string) error { return err } + var buf []byte if c == byte('#') { // shebang - skip that line _, err := reader.ReadBytes('\n') if err != nil && err != io.EOF { return err } + buf = []byte{'\n'} } - var buf []byte for { line, err := reader.ReadBytes('\n') if err != nil {