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