diff --git a/pkg/cli/cli.go b/pkg/cli/cli.go index 7b74436db7..af50425603 100644 --- a/pkg/cli/cli.go +++ b/pkg/cli/cli.go @@ -444,7 +444,7 @@ func (c *CLI) addExtraCommands() error { func (c CLI) printDeprecationWarnings() { for _, p := range c.resolvedPlugins { if p != nil && p.(plugin.Deprecated) != nil && len(p.(plugin.Deprecated).DeprecationWarning()) > 0 { - fmt.Printf(noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning())) + fmt.Fprintf(os.Stderr, noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning())) } } } diff --git a/pkg/cli/cli_test.go b/pkg/cli/cli_test.go index 7503e2cf18..ae5f8c7023 100644 --- a/pkg/cli/cli_test.go +++ b/pkg/cli/cli_test.go @@ -592,13 +592,13 @@ plugins: ) deprecatedPlugin := newMockDeprecatedPlugin("deprecated", "v1", deprecationWarning, projectVersion) - // Overwrite stdout to read the output and reset it afterwards + // Overwrite stderr to read the deprecation output and reset it afterwards r, w, _ := os.Pipe() - temp := os.Stdout + temp := os.Stderr defer func() { - os.Stdout = temp + os.Stderr = temp }() - os.Stdout = w + os.Stderr = w c, err = New( WithPlugins(deprecatedPlugin),