rob05c commented on code in PR #5696:
URL: https://github.com/apache/trafficcontrol/pull/5696#discussion_r876060447


##########
lib/go-log/log_test.go:
##########
@@ -42,3 +42,15 @@ func TestUTC(t *testing.T) {
                t.Errorf("expected UTC time, actual '" + actual + "'")
        }
 }
+
+func TestNewlinesSingleLogLine(t *testing.T) {
+       buf := &bytes.Buffer{}
+       Init(nil, writeCloser{buf}, nil, nil, nil)
+       // Have to concatenate, because Go doesn't allow you to test multiple 
trailing newline behavior.
+       Errorln("foo\n\nbar\n" + "\n" + "\n")

Review Comment:
   It won't build, `go test` implicitly runs `go vet` and fails if it fails.
   Changing that to
   ```
   Errorln("foo\n\nbar\n\n\n")
   ```
   Produces
   ```
   $ go test -v -failfast
   # github.com/apache/trafficcontrol/lib/go-log
   ./log_test.go:50:2: Errorln arg list ends with redundant newline
   FAIL    github.com/apache/trafficcontrol/lib/go-log [build failed]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to