ocket8888 commented on code in PR #5696:
URL: https://github.com/apache/trafficcontrol/pull/5696#discussion_r876233200
##########
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:
That's truly crazy to me. I should be able to print as many blank lines as I
want. And I'd bet that the compiler actually stores a single string constant
rather than doing the concatenation at runtime as an optimization, so Go's
basically refusing to allow you to do something it does itself.
--
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]