Skip to content

Commit 2450b1d

Browse files
authored
Don't print informational values to stdout (#1472)
The first message can probably be just removed. The primary reason I want to remove these is that it makes piping `-ojson` output to `jq` which I think should just print JSON and nothing else.
1 parent a09359c commit 2450b1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/cli/app/root.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package app
1818

1919
import (
2020
"fmt"
21+
"os"
2122

2223
"github.com/spf13/cobra"
2324
"github.com/spf13/viper"
@@ -77,10 +78,10 @@ func initConfig() {
7778
if err := viper.ReadInConfig(); err != nil {
7879
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
7980
// Config file not found; use default values
80-
fmt.Println("No config file present, using default values.")
81+
fmt.Fprintln(os.Stderr, "No config file present, using default values.")
8182
} else {
8283
// Some other error occurred
83-
fmt.Println("Error reading config file:", err)
84+
fmt.Fprintln(os.Stderr, "Error reading config file:", err)
8485
}
8586
}
8687
}

0 commit comments

Comments
 (0)