You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -91,72 +81,88 @@ func (e *Executor) initRun() {
91
81
// but when number of linters started to grow it became ovious that
92
82
// we can't fill 90% of flags by linters settings: common flags became hard to find.
93
83
// New linters settings should be done only through config file.
94
-
runCmd.Flags().BoolVar(&lsc.Errcheck.CheckTypeAssertions, "errcheck.check-type-assertions", false, "Errcheck: check for ignored type assertion results")
84
+
fs.BoolVar(&lsc.Errcheck.CheckTypeAssertions, "errcheck.check-type-assertions", false, "Errcheck: check for ignored type assertion results")
95
85
hideFlag("errcheck.check-type-assertions")
96
86
97
-
runCmd.Flags().BoolVar(&lsc.Errcheck.CheckAssignToBlank, "errcheck.check-blank", false, "Errcheck: check for errors assigned to blank identifier: _ = errFunc()")
87
+
fs.BoolVar(&lsc.Errcheck.CheckAssignToBlank, "errcheck.check-blank", false, "Errcheck: check for errors assigned to blank identifier: _ = errFunc()")
98
88
hideFlag("errcheck.check-blank")
99
89
100
-
runCmd.Flags().BoolVar(&lsc.Govet.CheckShadowing, "govet.check-shadowing", false, "Govet: check for shadowed variables")
90
+
fs.BoolVar(&lsc.Govet.CheckShadowing, "govet.check-shadowing", false, "Govet: check for shadowed variables")
101
91
hideFlag("govet.check-shadowing")
102
92
103
-
runCmd.Flags().Float64Var(&lsc.Golint.MinConfidence, "golint.min-confidence", 0.8, "Golint: minimum confidence of a problem to print it")
93
+
fs.Float64Var(&lsc.Golint.MinConfidence, "golint.min-confidence", 0.8, "Golint: minimum confidence of a problem to print it")
wh(fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all", strings.Join(lintersdb.AllPresets(), "|"))))
144
-
runCmd.Flags().BoolVar(&lc.Fast, "fast", false, wh("Run only fast linters from enabled linters set"))
134
+
fs.BoolVar(&lc.Fast, "fast", false, wh("Run only fast linters from enabled linters set"))
145
135
146
136
// Issues config
147
137
ic:=&e.cfg.Issues
148
-
runCmd.Flags().StringSliceVarP(&ic.ExcludePatterns, "exclude", "e", []string{}, wh("Exclude issue by regexp"))
wh("Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.\nIt's a super-useful option for integration of golangci-lint into existing large codebase.\nIt's not practical to fix all existing issues at the moment of integration: much better don't allow issues in new code"))
156
-
runCmd.Flags().StringVar(&ic.DiffFromRevision, "new-from-rev", "", wh("Show only new issues created after git revision `REV`"))
157
-
runCmd.Flags().StringVar(&ic.DiffPatchFilePath, "new-from-patch", "", wh("Show only new issues created in git patch with file path `PATH`"))
146
+
fs.StringVar(&ic.DiffFromRevision, "new-from-rev", "", wh("Show only new issues created after git revision `REV`"))
147
+
fs.StringVar(&ic.DiffPatchFilePath, "new-from-patch", "", wh("Show only new issues created in git patch with file path `PATH`"))
148
+
149
+
}
150
+
151
+
func (e*Executor) initRun() {
152
+
varrunCmd=&cobra.Command{
153
+
Use: "run",
154
+
Short: welcomeMessage,
155
+
Run: e.executeRun,
156
+
}
157
+
e.rootCmd.AddCommand(runCmd)
158
158
159
-
e.parseConfig(runCmd)
159
+
runCmd.SetOutput(printers.StdOut) // use custom output to properly color it in Windows terminals
160
+
161
+
fs:=runCmd.Flags()
162
+
fs.SortFlags=false// sort them as they are defined here
0 commit comments