From a49de5675811d716676d06614f13f4aec35074c9 Mon Sep 17 00:00:00 2001 From: darklore Date: Thu, 21 Oct 2021 11:04:14 +0900 Subject: [PATCH] Fix invalid shell completion when used with ~/.cobra.yaml (#1510) `cobra completion` outputs invalid output "Using config file:" at the top of the completion script. when ~/.cobra.yaml exists. --- cobra/cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index 51bba2cc5..cad3f451a 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -74,6 +74,6 @@ func initConfig() { viper.AutomaticEnv() if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) + fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed()) } }