diff --git a/altsrc/json_command_test.go b/altsrc/json_command_test.go index f2d3a8196d..cd583226fb 100644 --- a/altsrc/json_command_test.go +++ b/altsrc/json_command_test.go @@ -2,7 +2,6 @@ package altsrc import ( "flag" - "io/ioutil" "os" "testing" @@ -318,7 +317,7 @@ func TestCommandJSONFileFlagHasDefaultGlobalEnvJSONSetGlobalEnvWinsNested(t *tes } func writeTempFile(t *testing.T, name string, content string) func() { - if err := ioutil.WriteFile(name, []byte(content), 0666); err != nil { + if err := os.WriteFile(name, []byte(content), 0666); err != nil { t.Fatalf("cannot write %q: %v", name, err) } return func() { diff --git a/altsrc/json_source_context.go b/altsrc/json_source_context.go index 9beaca135e..aef357b7be 100644 --- a/altsrc/json_source_context.go +++ b/altsrc/json_source_context.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "strings" "time" @@ -40,7 +39,7 @@ func NewJSONSourceFromFile(f string) (InputSourceContext, error) { // NewJSONSourceFromReader returns an InputSourceContext suitable for // retrieving config variables from an io.Reader that returns JSON data. func NewJSONSourceFromReader(r io.Reader) (InputSourceContext, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/altsrc/toml_command_test.go b/altsrc/toml_command_test.go index d6def0efd2..91204d2d1c 100644 --- a/altsrc/toml_command_test.go +++ b/altsrc/toml_command_test.go @@ -2,7 +2,6 @@ package altsrc import ( "flag" - "io/ioutil" "os" "testing" @@ -12,7 +11,7 @@ import ( func TestCommandTomFileTest(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("test = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("test = 15"), 0666) defer os.Remove("current.toml") test := []string{"test-cmd", "--load", "current.toml"} _ = set.Parse(test) @@ -42,7 +41,7 @@ func TestCommandTomFileTest(t *testing.T) { func TestCommandTomlFileTestGlobalEnvVarWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("test = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("test = 15"), 0666) defer os.Remove("current.toml") _ = os.Setenv("THE_TEST", "10") @@ -76,7 +75,7 @@ func TestCommandTomlFileTestGlobalEnvVarWins(t *testing.T) { func TestCommandTomlFileTestGlobalEnvVarWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) defer os.Remove("current.toml") _ = os.Setenv("THE_TEST", "10") @@ -110,7 +109,7 @@ func TestCommandTomlFileTestGlobalEnvVarWinsNested(t *testing.T) { func TestCommandTomlFileTestSpecifiedFlagWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("test = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("test = 15"), 0666) defer os.Remove("current.toml") test := []string{"test-cmd", "--load", "current.toml", "--test", "7"} @@ -142,7 +141,7 @@ func TestCommandTomlFileTestSpecifiedFlagWins(t *testing.T) { func TestCommandTomlFileTestSpecifiedFlagWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte(`[top] + _ = os.WriteFile("current.toml", []byte(`[top] test = 15`), 0666) defer os.Remove("current.toml") @@ -175,7 +174,7 @@ func TestCommandTomlFileTestSpecifiedFlagWinsNested(t *testing.T) { func TestCommandTomlFileTestDefaultValueFileWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("test = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("test = 15"), 0666) defer os.Remove("current.toml") test := []string{"test-cmd", "--load", "current.toml"} @@ -207,7 +206,7 @@ func TestCommandTomlFileTestDefaultValueFileWins(t *testing.T) { func TestCommandTomlFileTestDefaultValueFileWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) defer os.Remove("current.toml") test := []string{"test-cmd", "--load", "current.toml"} @@ -239,7 +238,7 @@ func TestCommandTomlFileTestDefaultValueFileWinsNested(t *testing.T) { func TestCommandTomlFileFlagHasDefaultGlobalEnvTomlSetGlobalEnvWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("test = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("test = 15"), 0666) defer os.Remove("current.toml") _ = os.Setenv("THE_TEST", "11") @@ -273,7 +272,7 @@ func TestCommandTomlFileFlagHasDefaultGlobalEnvTomlSetGlobalEnvWins(t *testing.T func TestCommandTomlFileFlagHasDefaultGlobalEnvTomlSetGlobalEnvWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) + _ = os.WriteFile("current.toml", []byte("[top]\ntest = 15"), 0666) defer os.Remove("current.toml") _ = os.Setenv("THE_TEST", "11") diff --git a/altsrc/yaml_command_test.go b/altsrc/yaml_command_test.go index a297bd2d28..6f528f6368 100644 --- a/altsrc/yaml_command_test.go +++ b/altsrc/yaml_command_test.go @@ -2,7 +2,6 @@ package altsrc import ( "flag" - "io/ioutil" "os" "testing" @@ -12,7 +11,7 @@ import ( func TestCommandYamlFileTest(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte("test: 15"), 0666) + _ = os.WriteFile("current.yaml", []byte("test: 15"), 0666) defer os.Remove("current.yaml") test := []string{"test-cmd", "--load", "current.yaml"} _ = set.Parse(test) @@ -42,7 +41,7 @@ func TestCommandYamlFileTest(t *testing.T) { func TestCommandYamlFileTestGlobalEnvVarWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte("test: 15"), 0666) + _ = os.WriteFile("current.yaml", []byte("test: 15"), 0666) defer os.Remove("current.yaml") _ = os.Setenv("THE_TEST", "10") @@ -76,7 +75,7 @@ func TestCommandYamlFileTestGlobalEnvVarWins(t *testing.T) { func TestCommandYamlFileTestGlobalEnvVarWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte(`top: + _ = os.WriteFile("current.yaml", []byte(`top: test: 15`), 0666) defer os.Remove("current.yaml") @@ -111,7 +110,7 @@ func TestCommandYamlFileTestGlobalEnvVarWinsNested(t *testing.T) { func TestCommandYamlFileTestSpecifiedFlagWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte("test: 15"), 0666) + _ = os.WriteFile("current.yaml", []byte("test: 15"), 0666) defer os.Remove("current.yaml") test := []string{"test-cmd", "--load", "current.yaml", "--test", "7"} @@ -143,7 +142,7 @@ func TestCommandYamlFileTestSpecifiedFlagWins(t *testing.T) { func TestCommandYamlFileTestSpecifiedFlagWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte(`top: + _ = os.WriteFile("current.yaml", []byte(`top: test: 15`), 0666) defer os.Remove("current.yaml") @@ -176,7 +175,7 @@ func TestCommandYamlFileTestSpecifiedFlagWinsNested(t *testing.T) { func TestCommandYamlFileTestDefaultValueFileWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte("test: 15"), 0666) + _ = os.WriteFile("current.yaml", []byte("test: 15"), 0666) defer os.Remove("current.yaml") test := []string{"test-cmd", "--load", "current.yaml"} @@ -208,7 +207,7 @@ func TestCommandYamlFileTestDefaultValueFileWins(t *testing.T) { func TestCommandYamlFileTestDefaultValueFileWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte(`top: + _ = os.WriteFile("current.yaml", []byte(`top: test: 15`), 0666) defer os.Remove("current.yaml") @@ -241,7 +240,7 @@ func TestCommandYamlFileTestDefaultValueFileWinsNested(t *testing.T) { func TestCommandYamlFileFlagHasDefaultGlobalEnvYamlSetGlobalEnvWins(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte("test: 15"), 0666) + _ = os.WriteFile("current.yaml", []byte("test: 15"), 0666) defer os.Remove("current.yaml") _ = os.Setenv("THE_TEST", "11") @@ -275,7 +274,7 @@ func TestCommandYamlFileFlagHasDefaultGlobalEnvYamlSetGlobalEnvWins(t *testing.T func TestCommandYamlFileFlagHasDefaultGlobalEnvYamlSetGlobalEnvWinsNested(t *testing.T) { app := &cli.App{} set := flag.NewFlagSet("test", 0) - _ = ioutil.WriteFile("current.yaml", []byte(`top: + _ = os.WriteFile("current.yaml", []byte(`top: test: 15`), 0666) defer os.Remove("current.yaml") diff --git a/altsrc/yaml_file_loader.go b/altsrc/yaml_file_loader.go index 62e8965782..391069541f 100644 --- a/altsrc/yaml_file_loader.go +++ b/altsrc/yaml_file_loader.go @@ -2,7 +2,7 @@ package altsrc import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -68,7 +68,7 @@ func loadDataFrom(filePath string) ([]byte, error) { if err != nil { return nil, err } - return ioutil.ReadAll(res.Body) + return io.ReadAll(res.Body) default: return nil, fmt.Errorf("scheme of %s is unsupported", filePath) } @@ -76,13 +76,13 @@ func loadDataFrom(filePath string) ([]byte, error) { if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil { return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath) } - return ioutil.ReadFile(filePath) + return os.ReadFile(filePath) } else if runtime.GOOS == "windows" && strings.Contains(u.String(), "\\") { // on Windows systems u.Path is always empty, so we need to check the string directly. if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil { return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath) } - return ioutil.ReadFile(filePath) + return os.ReadFile(filePath) } return nil, fmt.Errorf("unable to determine how to load from path %s", filePath) diff --git a/app_test.go b/app_test.go index ccd63b9ef8..5952886622 100644 --- a/app_test.go +++ b/app_test.go @@ -6,7 +6,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "os" "reflect" "strconv" @@ -1278,7 +1277,7 @@ func TestApp_BeforeFunc(t *testing.T) { Flags: []Flag{ &StringFlag{Name: "opt"}, }, - Writer: ioutil.Discard, + Writer: io.Discard, } // run with the Before() func succeeding @@ -1369,7 +1368,7 @@ func TestApp_BeforeAfterFuncShellCompletion(t *testing.T) { Flags: []Flag{ &StringFlag{Name: "opt"}, }, - Writer: ioutil.Discard, + Writer: io.Discard, } // run with the Before() func succeeding @@ -1487,7 +1486,7 @@ func TestAppNoHelpFlag(t *testing.T) { HelpFlag = nil - app := &App{Writer: ioutil.Discard} + app := &App{Writer: io.Discard} err := app.Run([]string{"test", "-h"}) if err != flag.ErrHelp { @@ -1718,7 +1717,7 @@ func TestApp_OrderOfOperations(t *testing.T) { counts.OnUsageError = counts.Total return errors.New("hay OnUsageError") }, - Writer: ioutil.Discard, + Writer: io.Discard, } beforeNoError := func(c *Context) error { @@ -2308,7 +2307,7 @@ func TestApp_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) { Action: func(c *Context) error { return nil }, Before: func(c *Context) error { return fmt.Errorf("before error") }, After: func(c *Context) error { return fmt.Errorf("after error") }, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo"}) @@ -2458,7 +2457,7 @@ func (c *customBoolFlag) IsSet() bool { func TestCustomFlagsUnused(t *testing.T) { app := &App{ Flags: []Flag{&customBoolFlag{"custom"}}, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo"}) @@ -2470,7 +2469,7 @@ func TestCustomFlagsUnused(t *testing.T) { func TestCustomFlagsUsed(t *testing.T) { app := &App{ Flags: []Flag{&customBoolFlag{"custom"}}, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo", "--custom=bar"}) @@ -2481,7 +2480,7 @@ func TestCustomFlagsUsed(t *testing.T) { func TestCustomHelpVersionFlags(t *testing.T) { app := &App{ - Writer: ioutil.Discard, + Writer: io.Discard, } // Be sure to reset the global flags @@ -2573,7 +2572,7 @@ func TestShellCompletionForIncompleteFlags(t *testing.T) { Action: func(ctx *Context) error { return fmt.Errorf("should not get here") }, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"", "--test-completion", "--" + "generate-bash-completion"}) if err != nil { @@ -2636,7 +2635,7 @@ func TestWhenExitSubCommandWithCodeThenAppQuitUnexpectedly(t *testing.T) { func newTestApp() *App { a := NewApp() - a.Writer = ioutil.Discard + a.Writer = io.Discard return a } diff --git a/command_test.go b/command_test.go index 70caee750d..53ca54bd21 100644 --- a/command_test.go +++ b/command_test.go @@ -5,7 +5,7 @@ import ( "errors" "flag" "fmt" - "io/ioutil" + "io" "reflect" "strings" "testing" @@ -27,7 +27,7 @@ func TestCommandFlagParsing(t *testing.T) { } for _, c := range cases { - app := &App{Writer: ioutil.Discard} + app := &App{Writer: io.Discard} set := flag.NewFlagSet("test", 0) _ = set.Parse(c.testArgs) @@ -118,7 +118,7 @@ func TestCommand_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) { }, }, }, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo", "bar"}) @@ -271,7 +271,7 @@ func TestCommand_OnUsageError_WithSubcommand(t *testing.T) { func TestCommand_Run_SubcommandsCanUseErrWriter(t *testing.T) { app := &App{ - ErrWriter: ioutil.Discard, + ErrWriter: io.Discard, Commands: []*Command{ { Name: "bar", @@ -281,7 +281,7 @@ func TestCommand_Run_SubcommandsCanUseErrWriter(t *testing.T) { Name: "baz", Usage: "this is for testing", Action: func(c *Context) error { - if c.App.ErrWriter != ioutil.Discard { + if c.App.ErrWriter != io.Discard { return fmt.Errorf("ErrWriter not passed") } @@ -325,7 +325,7 @@ func TestCommandSkipFlagParsing(t *testing.T) { }, }, }, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run(c.testArgs) @@ -406,7 +406,7 @@ func TestCommand_NoVersionFlagOnCommands(t *testing.T) { func TestCommand_CanAddVFlagOnCommands(t *testing.T) { app := &App{ Version: "some version", - Writer: ioutil.Discard, + Writer: io.Discard, Commands: []*Command{ { Name: "bar", diff --git a/docs/v1/examples/version-flag.md b/docs/v1/examples/version-flag.md index dc089a16ae..a3e695a2ef 100644 --- a/docs/v1/examples/version-flag.md +++ b/docs/v1/examples/version-flag.md @@ -94,7 +94,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "os" "time" @@ -119,7 +118,7 @@ func init() { cli.OsExiter = func(c int) { fmt.Fprintf(cli.ErrWriter, "refusing to exit %d\n", c) } - cli.ErrWriter = ioutil.Discard + cli.ErrWriter = io.Discard cli.FlagStringer = func(fl cli.Flag) string { return fmt.Sprintf("\t\t%s", fl.GetName()) } diff --git a/docs/v2/examples/full-api-example.md b/docs/v2/examples/full-api-example.md index 289cffeb34..6a33096350 100644 --- a/docs/v2/examples/full-api-example.md +++ b/docs/v2/examples/full-api-example.md @@ -16,10 +16,9 @@ package main import ( "errors" - "flag" + "flag" "fmt" "io" - "io/ioutil" "os" "time" @@ -43,7 +42,7 @@ func init() { cli.OsExiter = func(cCtx int) { fmt.Fprintf(cli.ErrWriter, "refusing to exit %d\n", cCtx) } - cli.ErrWriter = ioutil.Discard + cli.ErrWriter = io.Discard cli.FlagStringer = func(fl cli.Flag) string { return fmt.Sprintf("\t\t%s", fl.Names()[0]) } @@ -58,7 +57,7 @@ func (w *hexWriter) Write(p []byte) (int, error) { fmt.Printf("\n") return len(p), nil -} +} type genericType struct { s string diff --git a/fish_test.go b/fish_test.go index af1a14c441..d28b0d4202 100644 --- a/fish_test.go +++ b/fish_test.go @@ -2,7 +2,7 @@ package cli import ( "bytes" - "io/ioutil" + "os" "testing" ) @@ -135,7 +135,7 @@ Should be a part of the same code block } func expectFileContent(t *testing.T, file, got string) { - data, err := ioutil.ReadFile(file) + data, err := os.ReadFile(file) // Ignore windows line endings // TODO: Replace with bytes.ReplaceAll when support for Go 1.11 is dropped data = bytes.Replace(data, []byte("\r\n"), []byte("\n"), -1) diff --git a/flag.go b/flag.go index fc3744ec8e..4d04de3da8 100644 --- a/flag.go +++ b/flag.go @@ -4,7 +4,7 @@ import ( "errors" "flag" "fmt" - "io/ioutil" + "io" "os" "regexp" "runtime" @@ -178,7 +178,7 @@ func flagSet(name string, flags []Flag, spec separatorSpec) (*flag.FlagSet, erro return nil, err } } - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) return set, nil } @@ -384,7 +384,7 @@ func flagFromEnvOrFile(envVars []string, filePath string) (value string, fromWhe } for _, fileVar := range strings.Split(filePath, ",") { if fileVar != "" { - if data, err := ioutil.ReadFile(fileVar); err == nil { + if data, err := os.ReadFile(fileVar); err == nil { return string(data), fmt.Sprintf("file %q", filePath), true } } diff --git a/flag_test.go b/flag_test.go index 60370aceb2..21ded7545c 100644 --- a/flag_test.go +++ b/flag_test.go @@ -4,7 +4,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "os" "reflect" "regexp" @@ -2904,7 +2903,7 @@ func TestParseGenericFromEnvCascade(t *testing.T) { } func TestFlagFromFile(t *testing.T) { - temp, err := ioutil.TempFile("", "urfave_cli_test") + temp, err := os.CreateTemp("", "urfave_cli_test") if err != nil { t.Error(err) return @@ -3071,7 +3070,7 @@ func TestTimestampFlagApplyValue(t *testing.T) { func TestTimestampFlagApply_Fail_Parse_Wrong_Layout(t *testing.T) { fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Layout: "randomlayout"} set := flag.NewFlagSet("test", 0) - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) _ = fl.Apply(set) err := set.Parse([]string{"--time", "2006-01-02T15:04:05Z"}) @@ -3081,7 +3080,7 @@ func TestTimestampFlagApply_Fail_Parse_Wrong_Layout(t *testing.T) { func TestTimestampFlagApply_Fail_Parse_Wrong_Time(t *testing.T) { fl := TimestampFlag{Name: "time", Aliases: []string{"t"}, Layout: "Jan 2, 2006 at 3:04pm (MST)"} set := flag.NewFlagSet("test", 0) - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) _ = fl.Apply(set) err := set.Parse([]string{"--time", "2006-01-02T15:04:05Z"}) @@ -3175,7 +3174,7 @@ func TestFlagDefaultValue(t *testing.T) { } for i, v := range cases { set := flag.NewFlagSet("test", 0) - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) _ = v.flag.Apply(set) if err := set.Parse(v.toParse); err != nil { t.Error(err) @@ -3353,7 +3352,7 @@ func TestFlagDefaultValueWithEnv(t *testing.T) { os.Setenv(key, val) } set := flag.NewFlagSet("test", 0) - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) if err := v.flag.Apply(set); err != nil { t.Fatal(err) } @@ -3414,7 +3413,7 @@ func TestFlagValue(t *testing.T) { } for i, v := range cases { set := flag.NewFlagSet("test", 0) - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) _ = v.flag.Apply(set) if err := set.Parse(v.toParse); err != nil { t.Error(err) diff --git a/help_test.go b/help_test.go index 8e9396dc8f..f508fe965e 100644 --- a/help_test.go +++ b/help_test.go @@ -5,7 +5,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "os" "runtime" "strings" @@ -986,7 +985,7 @@ App UsageText`, func TestHideHelpCommand(t *testing.T) { app := &App{ HideHelpCommand: true, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo", "help"}) @@ -1006,7 +1005,7 @@ func TestHideHelpCommand(t *testing.T) { func TestHideHelpCommand_False(t *testing.T) { app := &App{ HideHelpCommand: false, - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo", "help"}) @@ -1024,7 +1023,7 @@ func TestHideHelpCommand_WithHideHelp(t *testing.T) { app := &App{ HideHelp: true, // effective (hides both command and flag) HideHelpCommand: true, // ignored - Writer: ioutil.Discard, + Writer: io.Discard, } err := app.Run([]string{"foo", "help"}) @@ -1053,7 +1052,7 @@ func newContextFromStringSlice(ss []string) *Context { func TestHideHelpCommand_RunAsSubcommand(t *testing.T) { app := &App{ HideHelpCommand: true, - Writer: ioutil.Discard, + Writer: io.Discard, Commands: []*Command{ { Name: "dummy", @@ -1078,7 +1077,7 @@ func TestHideHelpCommand_RunAsSubcommand(t *testing.T) { func TestHideHelpCommand_RunAsSubcommand_False(t *testing.T) { app := &App{ HideHelpCommand: false, - Writer: ioutil.Discard, + Writer: io.Discard, Commands: []*Command{ { Name: "dummy", @@ -1099,7 +1098,7 @@ func TestHideHelpCommand_RunAsSubcommand_False(t *testing.T) { func TestHideHelpCommand_WithSubcommands(t *testing.T) { app := &App{ - Writer: ioutil.Discard, + Writer: io.Discard, Commands: []*Command{ { Name: "dummy",