From 9bbd98b92d16151f8ccd0aa139858147ab5d91b3 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 21 Jan 2020 21:06:16 +0300 Subject: [PATCH 1/1] Trim possible \r --- cmd/sgblog-comment-add/main.go | 4 ++-- common.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/sgblog-comment-add/main.go b/cmd/sgblog-comment-add/main.go index 8b46c55..100f5f2 100644 --- a/cmd/sgblog-comment-add/main.go +++ b/cmd/sgblog-comment-add/main.go @@ -98,13 +98,13 @@ func main() { "notes", "--ref", *notesRef, "show", subj, ) note, _ := cmd.Output() - note = bytes.TrimSuffix(note, []byte{'\n'}) + note = bytes.TrimRight(note, "\r\n") // Remove trailing whitespaces, because git-notes-add will remove // them anyway, and we have to know exact bytes count lines := strings.Split(string(body), "\n") for i, line := range lines { - lines[i] = strings.TrimRight(line, " ") + lines[i] = strings.TrimRight(line, " \r") } for lines[len(lines)-1] == "" { lines = lines[:len(lines)-1] diff --git a/common.go b/common.go index 183ac3d..a9b2a6d 100644 --- a/common.go +++ b/common.go @@ -3,5 +3,5 @@ package sgblog const ( WhenFmt = "2006-01-02 15:04:05Z07:00" - Version = "0.3.0" + Version = "0.3.1" ) -- 2.44.0