From 25bab5a3982e8b0c301a9d63b2999bbd34d360c6 Mon Sep 17 00:00:00 2001 From: darklore <958690+darklore@users.noreply.github.com> Date: Wed, 8 Dec 2021 08:00:50 +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()) } }