From daf909af689bdac1494f32e25f8cb69f9c4a44db Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 19 Mar 2024 20:29:50 +0100 Subject: [PATCH] chore: silence some command usage on error --- pkg/commands/custom.go | 11 ++++++----- pkg/commands/linters.go | 1 + pkg/commands/run.go | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/commands/custom.go b/pkg/commands/custom.go index dd7b1bb2bd75..1bc9f9014615 100644 --- a/pkg/commands/custom.go +++ b/pkg/commands/custom.go @@ -25,11 +25,12 @@ func newCustomCommand(logger logutils.Log) *customCommand { c := &customCommand{log: logger} customCmd := &cobra.Command{ - Use: "custom", - Short: "Build a version of golangci-lint with custom linters", - Args: cobra.NoArgs, - PreRunE: c.preRunE, - RunE: c.runE, + Use: "custom", + Short: "Build a version of golangci-lint with custom linters", + Args: cobra.NoArgs, + PreRunE: c.preRunE, + RunE: c.runE, + SilenceUsage: true, } c.cmd = customCmd diff --git a/pkg/commands/linters.go b/pkg/commands/linters.go index 083947707dd4..61ed0f22f27b 100644 --- a/pkg/commands/linters.go +++ b/pkg/commands/linters.go @@ -44,6 +44,7 @@ func newLintersCommand(logger logutils.Log) *lintersCommand { ValidArgsFunction: cobra.NoFileCompletions, RunE: c.execute, PreRunE: c.preRunE, + SilenceUsage: true, } fs := lintersCmd.Flags() diff --git a/pkg/commands/run.go b/pkg/commands/run.go index 48d4ef8ce749..8ed8c5eed20f 100644 --- a/pkg/commands/run.go +++ b/pkg/commands/run.go @@ -118,6 +118,7 @@ func newRunCommand(logger logutils.Log, info BuildInfo) *runCommand { PostRun: c.postRun, PersistentPreRunE: c.persistentPreRunE, PersistentPostRunE: c.persistentPostRunE, + SilenceUsage: true, } runCmd.SetOut(logutils.StdOut) // use custom output to properly color it in Windows terminals