From 5d3eee1b5264f20dab28d4ec7055d9225724832d Mon Sep 17 00:00:00 2001 From: NI Date: Fri, 15 Apr 2022 18:14:31 +0800 Subject: [PATCH] Fixed misuses of `fmt.Println` and `t.Error` --- application/command/handler.go | 2 +- application/commands/integer_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/command/handler.go b/application/command/handler.go index b8aab22..e808714 100644 --- a/application/command/handler.go +++ b/application/command/handler.go @@ -80,7 +80,7 @@ func (h *handlerSender) signal(hd Header, d []byte, buf []byte) error { dLen := len(d) if bufLen < dLen+1 { - panic(fmt.Sprintln("Sending signal %s:%d requires %d bytes of buffer, "+ + panic(fmt.Sprintf("Sending signal %s:%d requires %d bytes of buffer, "+ "but only %d bytes is available", hd, d, dLen+1, bufLen)) } diff --git a/application/commands/integer_test.go b/application/commands/integer_test.go index 5eeee9d..a76ee5b 100644 --- a/application/commands/integer_test.go +++ b/application/commands/integer_test.go @@ -65,7 +65,7 @@ func TestIntegerSingleByte1(t *testing.T) { } if mLen != 1 { - t.Error("Expecting the Integer to be marshalled into %d bytes, got "+ + t.Errorf("Expecting the Integer to be marshalled into %d bytes, got "+ "%d instead", 1, mLen) return @@ -101,7 +101,7 @@ func TestIntegerSingleByte2(t *testing.T) { } if mLen != 1 { - t.Error("Expecting the Integer to be marshalled into %d bytes, got "+ + t.Errorf("Expecting the Integer to be marshalled into %d bytes, got "+ "%d instead", 1, mLen) return