Skip to content

Commit 1b6f006

Browse files
authored
dev: silence help on some commands usage on error (#4542)
1 parent eaafdf3 commit 1b6f006

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

pkg/commands/custom.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ func newCustomCommand(logger logutils.Log) *customCommand {
2525
c := &customCommand{log: logger}
2626

2727
customCmd := &cobra.Command{
28-
Use: "custom",
29-
Short: "Build a version of golangci-lint with custom linters",
30-
Args: cobra.NoArgs,
31-
PreRunE: c.preRunE,
32-
RunE: c.runE,
28+
Use: "custom",
29+
Short: "Build a version of golangci-lint with custom linters",
30+
Args: cobra.NoArgs,
31+
PreRunE: c.preRunE,
32+
RunE: c.runE,
33+
SilenceUsage: true,
3334
}
3435

3536
c.cmd = customCmd

pkg/commands/linters.go

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func newLintersCommand(logger logutils.Log) *lintersCommand {
4444
ValidArgsFunction: cobra.NoFileCompletions,
4545
RunE: c.execute,
4646
PreRunE: c.preRunE,
47+
SilenceUsage: true,
4748
}
4849

4950
fs := lintersCmd.Flags()

pkg/commands/run.go

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func newRunCommand(logger logutils.Log, info BuildInfo) *runCommand {
118118
PostRun: c.postRun,
119119
PersistentPreRunE: c.persistentPreRunE,
120120
PersistentPostRunE: c.persistentPostRunE,
121+
SilenceUsage: true,
121122
}
122123

123124
runCmd.SetOut(logutils.StdOut) // use custom output to properly color it in Windows terminals

0 commit comments

Comments
 (0)