Skip to content

Commit

Permalink
Don't print informational values to stdout (#1472)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhrozek committed Nov 4, 2023
1 parent a09359c commit 2450b1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/cli/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package app

import (
"fmt"
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -77,10 +78,10 @@ func initConfig() {
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
// Config file not found; use default values
fmt.Println("No config file present, using default values.")
fmt.Fprintln(os.Stderr, "No config file present, using default values.")
} else {
// Some other error occurred
fmt.Println("Error reading config file:", err)
fmt.Fprintln(os.Stderr, "Error reading config file:", err)
}
}
}

0 comments on commit 2450b1d

Please sign in to comment.