From 9f0bbccb9b4cd4693e1c70e3a4ae90fc222ce863 Mon Sep 17 00:00:00 2001 From: Luc Blassel Date: Sun, 28 Apr 2024 11:37:44 +0200 Subject: [PATCH 1/3] Fixing newick parsing to accepts trailing whitespace after semicolon --- io/fileutils/readln.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From b959a7f3eccdebda804206232a37f1d651f5dd5c Mon Sep 17 00:00:00 2001 From: Luc Blassel Date: Sun, 28 Apr 2024 11:40:24 +0200 Subject: [PATCH 2/3] Specifying bash as test.sh language --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7198444..6ebca1e 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ The `gotree` executable should be located in the current folder (or the `$GOPATH To test the executable: ``` -./test.sh +bash test.sh ``` ## Auto completion From f44057354b2cc75e3e569244ff2920203eb51acf Mon Sep 17 00:00:00 2001 From: Arthur Carcano Date: Mon, 29 Apr 2024 10:03:16 +0200 Subject: [PATCH 3/3] Use a shebang to enforce running test.sh in bash Commit b959a7f3eccdebda804206232a37f1d651f5dd5c was made because `test.sh` cannot run on systems where the default shell is not bash compatible (e.g. zsh). (cf https://github.com/evolbioinfo/gotree/pull/23) A [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) allows to force the use of bash to interpret the shell script. This version using `/usr/bin/env` should be the most portable. --- README.md | 2 +- test.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ebca1e..7198444 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ The `gotree` executable should be located in the current folder (or the `$GOPATH To test the executable: ``` -bash test.sh +./test.sh ``` ## Auto completion 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