diff --git a/io/fileutils/readln.go b/io/fileutils/readln.go index c23d532..2fc72c8 100644 --- a/io/fileutils/readln.go +++ b/io/fileutils/readln.go @@ -37,7 +37,13 @@ func ReadUntilSemiColon(r *bufio.Reader) (string, error) { line, isPrefix, err = r.ReadLine() ln = append(ln, line...) if len(ln) > 0 { - lastChar = ln[len(ln)-1] + i := len(ln) - 1 + lastChar = ln[i] + // Test what last non-space character of the line is + for (lastChar == ' ' || lastChar == '\t') && i >= 0 { + i-- + lastChar = ln[i] + } } } return string(ln), err diff --git a/test.sh b/test.sh index 807d21c..0a89462 100755 --- a/test.sh +++ b/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash ########## Test Suite for Gotree command line tools ############## set -e