Skip to content

Commit 71f2c32

Browse files
committed
Reduce indirection in clibasetest.IO
1 parent 2884aa6 commit 71f2c32

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

cli/clibase/clibasetest/invokation.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@ import (
1010

1111
// IO is the standard input, output, and error for a command.
1212
type IO struct {
13-
Stdin *bytes.Buffer
14-
Stdout *bytes.Buffer
15-
Stderr *bytes.Buffer
13+
Stdin bytes.Buffer
14+
Stdout bytes.Buffer
15+
Stderr bytes.Buffer
1616
}
1717

1818
// FakeIO sets Stdin, Stdout, and Stderr to buffers.
1919
func FakeIO(i *clibase.Invokation) *IO {
20-
b := &IO{
21-
Stdin: bytes.NewBuffer(nil),
22-
Stdout: bytes.NewBuffer(nil),
23-
Stderr: bytes.NewBuffer(nil),
24-
}
25-
i.Stdout = b.Stdout
26-
i.Stderr = b.Stderr
27-
i.Stdin = b.Stdin
28-
return b
20+
var b IO
21+
i.Stdout = &b.Stdout
22+
i.Stderr = &b.Stderr
23+
i.Stdin = &b.Stdin
24+
return &b
2925
}
3026

3127
type testWriter struct {

0 commit comments

Comments
 (0)