Skip to content
Myr

Replace deprecated SetOutput func with SetOut and SetErr in test (#1053)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kanji Yomoda · committed by GitHub · parent 6607e6b · Browse files · 2 files+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−4 removed

  • other:+8 added−4 removed

2 files+8 added−4 removed

modified:cobra/cmd/golden_test.go+4 added-2 removed
11 unmodified lines
12var update = flag.Bool("update", false, "update .golden files")1314func init() {15 // Mute commands.16 addCmd.SetOutput(new(bytes.Buffer))17 initCmd.SetOutput(new(bytes.Buffer))16 addCmd.SetOut(new(bytes.Buffer))17 addCmd.SetErr(new(bytes.Buffer))18 initCmd.SetOut(new(bytes.Buffer))19 initCmd.SetErr(new(bytes.Buffer))20}2122// ensureLF converts any \r\n to \n23func ensureLF(content []byte) []byte {
61 unmodified lines
modified:command_test.go+4 added-2 removed
19 unmodified lines
20}2122func executeCommandWithContext(ctx context.Context, root *Command, args ...string) (output string, err error) {23 buf := new(bytes.Buffer)24 root.SetOutput(buf)24 root.SetOut(buf)25 root.SetErr(buf)26 root.SetArgs(args)2728 err = root.ExecuteContext(ctx)29
1 unmodified line
31}3233func executeCommandC(root *Command, args ...string) (c *Command, output string, err error) {34 buf := new(bytes.Buffer)34 root.SetOutput(buf)35 root.SetOut(buf)36 root.SetErr(buf)37 root.SetArgs(args)3839 c, err = root.ExecuteC()40
1919 unmodified lines