Refactor buffer initialization in client tests

Replaced &bytes.Buffer{} with bytes.NewBuffer(nil) for buffer initialization in various client tests. This change ensures more idiomatic and consistent creation of byte buffers throughout the test cases.
This commit is contained in:
Winni Neessen 2024-10-23 17:58:08 +02:00
parent 21184e60b9
commit 0db1383940
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -1135,7 +1135,7 @@ func TestClient_SetDebugLog(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to create new client: %s", err) t.Fatalf("failed to create new client: %s", err)
} }
buffer := &bytes.Buffer{} buffer := bytes.NewBuffer(nil)
client.SetLogger(log.New(buffer, log.LevelDebug)) client.SetLogger(log.New(buffer, log.LevelDebug))
client.SetDebugLog(true) client.SetDebugLog(true)
@ -1164,7 +1164,7 @@ func TestClient_SetDebugLog(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to create new client: %s", err) t.Fatalf("failed to create new client: %s", err)
} }
buffer := &bytes.Buffer{} buffer := bytes.NewBuffer(nil)
client.SetLogger(log.New(buffer, log.LevelDebug)) client.SetLogger(log.New(buffer, log.LevelDebug))
client.SetDebugLog(false) client.SetDebugLog(false)
@ -1202,7 +1202,7 @@ func TestClient_SetDebugLog(t *testing.T) {
} }
}) })
buffer := &bytes.Buffer{} buffer := bytes.NewBuffer(nil)
client.SetLogger(log.New(buffer, log.LevelDebug)) client.SetLogger(log.New(buffer, log.LevelDebug))
client.SetDebugLog(true) client.SetDebugLog(true)
if err = client.smtpClient.Noop(); err != nil { if err = client.smtpClient.Noop(); err != nil {