test: Use bytes.Buffer.String

Fix some warnings from go-staticcheck.

"should use buffer.String() instead of string(buffer.Bytes()) (S1030)"

This warning is explained at this link.
https://staticcheck.io/docs/checks#S1030
This commit is contained in:
Masashi Honma 2021-03-22 17:41:15 +09:00
parent cf3374e434
commit 39538463de

View File

@ -797,8 +797,8 @@ COMMIT
t.Fatalf("%s: Expected success, got %v", protocol, err) t.Fatalf("%s: Expected success, got %v", protocol, err)
} }
if string(buffer.Bytes()) != output { if buffer.String() != output {
t.Errorf("%s: Expected output '%s', got '%v'", protocol, output, string(buffer.Bytes())) t.Errorf("%s: Expected output '%s', got '%v'", protocol, output, buffer.String())
} }
if fcmd.CombinedOutputCalls != 1 { if fcmd.CombinedOutputCalls != 1 {
@ -817,8 +817,8 @@ COMMIT
if err == nil { if err == nil {
t.Errorf("%s: Expected failure", protocol) t.Errorf("%s: Expected failure", protocol)
} }
if string(buffer.Bytes()) != stderrOutput { if buffer.String() != stderrOutput {
t.Errorf("%s: Expected output '%s', got '%v'", protocol, stderrOutput, string(buffer.Bytes())) t.Errorf("%s: Expected output '%s', got '%v'", protocol, stderrOutput, buffer.String())
} }
} }