From: Sergey Matveev Date: Tue, 21 Jan 2020 18:06:16 +0000 (+0300) Subject: Trim possible \r X-Git-Tag: v0.3.1^0 X-Git-Url: http://www.git.stargrave.org/?p=sgblog.git;a=commitdiff_plain;h=9bbd98b92d16151f8ccd0aa139858147ab5d91b3 Trim possible \r --- 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" )