Remove/replace SetOutput on Command - deprecated

This commit is contained in:
John McBride 2020-04-02 12:20:02 -06:00
parent 138b98f39d
commit 6291af1f4d
2 changed files with 2 additions and 16 deletions

View file

@ -218,13 +218,6 @@ func (c *Command) SetArgs(a []string) {
c.args = a
}
// SetOutput sets the destination for usage and error messages.
// If output is nil, os.Stderr is used.
// Deprecated: Use SetOut and/or SetErr instead
func (c *Command) SetOutput(output io.Writer) {
c.outWriter = output
c.errWriter = output
}
// SetOut sets the destination for usage messages.
// If newOut is nil, os.Stdout is used.

View file

@ -1557,14 +1557,6 @@ func TestEnableCommandSortingIsDisabled(t *testing.T) {
EnableCommandSorting = true
}
func TestSetOutput(t *testing.T) {
c := &Command{}
c.SetOutput(nil)
if out := c.OutOrStdout(); out != os.Stdout {
t.Errorf("Expected setting output to nil to revert back to stdout")
}
}
func TestSetOut(t *testing.T) {
c := &Command{}
c.SetOut(nil)
@ -1814,7 +1806,8 @@ func (tc *calledAsTestcase) test(t *testing.T) {
parent.SetArgs(tc.args)
output := new(bytes.Buffer)
parent.SetOutput(output)
parent.SetOut(output)
parent.SetErr(output)
parent.Execute()