pkg/stdcopy: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 14:19:49 +01:00
parent 1216328c2d
commit f930559076
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -63,7 +63,8 @@ func TestWriteWithWriterError(t *testing.T) {
expectedReturnedBytes := 10
writer := NewStdWriter(&errWriter{
n: stdWriterPrefixLen + expectedReturnedBytes,
err: expectedError}, Stdout)
err: expectedError,
}, Stdout)
data := []byte("This won't get written, sigh")
n, err := writer.Write(data)
if err != expectedError {
@ -132,7 +133,8 @@ func (f *customReader) Read(buf []byte) (int, error) {
func TestStdCopyReturnsErrorReadingHeader(t *testing.T) {
expectedError := errors.New("error")
reader := &customReader{
err: expectedError}
err: expectedError,
}
written, err := StdCopy(io.Discard, io.Discard, reader)
if written != 0 {
t.Fatalf("Expected 0 bytes read, got %d", written)
@ -154,7 +156,8 @@ func TestStdCopyReturnsErrorReadingFrame(t *testing.T) {
correctCalls: 1,
n: stdWriterPrefixLen + 1,
err: expectedError,
src: buffer}
src: buffer,
}
written, err := StdCopy(io.Discard, io.Discard, reader)
if written != 0 {
t.Fatalf("Expected 0 bytes read, got %d", written)
@ -175,7 +178,8 @@ func TestStdCopyDetectsCorruptedFrame(t *testing.T) {
correctCalls: 1,
n: stdWriterPrefixLen + 1,
err: io.EOF,
src: buffer}
src: buffer,
}
written, err := StdCopy(io.Discard, io.Discard, reader)
if written != startingBufLen {
t.Fatalf("Expected %d bytes read, got %d", startingBufLen, written)