]> Sergey Matveev's repositories - sgblog.git/commitdiff
Trim possible \r v0.3.1
authorSergey Matveev <stargrave@stargrave.org>
Tue, 21 Jan 2020 18:06:16 +0000 (21:06 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 21 Jan 2020 18:06:36 +0000 (21:06 +0300)
cmd/sgblog-comment-add/main.go
common.go

index 8b46c555929ca3a17ddf06e19486b30d5e957e90..100f5f2138339b56e058277c5f1af9c29f2922d7 100644 (file)
@@ -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]
index 183ac3d2bc2f5fcaff449ac3b6436112feb4dd53..a9b2a6d4f1a6969f0dcfb9581f2fe3eb6006ca93 100644 (file)
--- 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"
 )