lines should end with a newline

master
Jordan Orelli 5 years ago
parent bd13f6b43c
commit e4846cb3c4

@ -1,5 +1,3 @@
module github.com/jordanorelli/blammo
go 1.13
require golang.org/x/crypto v0.0.0-20200117160349-530e935923ad // indirect

@ -1,8 +0,0 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

@ -66,6 +66,7 @@ func (l *LineWriter) WriteEvent(e *Event) {
if e.Text != "" {
buf.WriteRune(' ')
buf.WriteString(strings.ReplaceAll(e.Text, string('\n'), "\n"))
buf.WriteRune('\n')
}
l.out.Lock()

@ -2,6 +2,7 @@ package blammo
import (
"bytes"
"strings"
"testing"
"time"
)
@ -124,6 +125,7 @@ func TestLineWriter(t *testing.T) {
w := NewLineWriter(&buf)
w.WriteEvent(&test.event)
line := buf.String()
line = strings.TrimSuffix(line, "\n")
if line != test.line {
t.Log("expected line does not match observed line")
t.Logf("expected line: '%s'", test.line)

Loading…
Cancel
Save