Skip to content

Commit

Permalink
Remove usage info from log output (#1242)
Browse files Browse the repository at this point in the history
Remove usage info from log output.

Problem: When a critical error occurs at startup, usage information for the binary is dumped into the log output.

Solution: Set SilenceUsage and SilenceErrors to true in the root cobra.Command.
  • Loading branch information
bjee19 authored Nov 13, 2023
1 parent 9e7ff57 commit ce4d1cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/gateway/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const (

func createRootCommand() *cobra.Command {
rootCmd := &cobra.Command{
Use: "gateway",
Use: "gateway",
SilenceUsage: true,
SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Expand Down

0 comments on commit ce4d1cc

Please sign in to comment.