@@ -41,11 +41,19 @@ func wh(text string) string {
41
41
return color .GreenString (text )
42
42
}
43
43
44
- func initFlagSet (fs * pflag.FlagSet , cfg * config.Config , m * lintersdb.Manager ) {
44
+ func initFlagSet (fs * pflag.FlagSet , cfg * config.Config , m * lintersdb.Manager , isFinalInit bool ) {
45
45
hideFlag := func (name string ) {
46
46
if err := fs .MarkHidden (name ); err != nil {
47
47
panic (err )
48
48
}
49
+
50
+ // we run initFlagSet multiple times, but we wouldn't like to see deprecation message multiple times
51
+ if isFinalInit {
52
+ const deprecateMessage = "flag will be removed soon, please, use .golangci.yml config"
53
+ if err := fs .MarkDeprecated (name , deprecateMessage ); err != nil {
54
+ panic (err )
55
+ }
56
+ }
49
57
}
50
58
51
59
// Output config
@@ -85,9 +93,11 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager) {
85
93
fs .BoolVar (& lsc .Errcheck .CheckAssignToBlank , "errcheck.check-blank" , false ,
86
94
"Errcheck: check for errors assigned to blank identifier: _ = errFunc()" )
87
95
hideFlag ("errcheck.check-blank" )
88
- fs .StringVar (& lsc .Errcheck .Exclude , "errcheck.exclude" , "" , "errcheck.exclude" )
96
+ fs .StringVar (& lsc .Errcheck .Exclude , "errcheck.exclude" , "" ,
97
+ "Path to a file containing a list of functions to exclude from checking" )
89
98
hideFlag ("errcheck.exclude" )
90
- fs .Var (& lsc .Errcheck .Ignore , "errcheck.ignore" , "errcheck.ignore" )
99
+ fs .StringVar (& lsc .Errcheck .Ignore , "errcheck.ignore" , "fmt:.*" ,
100
+ `Comma-separated list of pairs of the form pkg:regex. The regex is used to ignore names within pkg` )
91
101
hideFlag ("errcheck.ignore" )
92
102
93
103
fs .BoolVar (& lsc .Govet .CheckShadowing , "govet.check-shadowing" , false ,
@@ -171,7 +181,7 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager) {
171
181
func (e * Executor ) initRunConfiguration (cmd * cobra.Command ) {
172
182
fs := cmd .Flags ()
173
183
fs .SortFlags = false // sort them as they are defined here
174
- initFlagSet (fs , e .cfg , e .DBManager )
184
+ initFlagSet (fs , e .cfg , e .DBManager , true )
175
185
}
176
186
177
187
func (e Executor ) getConfigForCommandLine () (* config.Config , error ) {
@@ -184,7 +194,7 @@ func (e Executor) getConfigForCommandLine() (*config.Config, error) {
184
194
// `changed` variable inside string slice vars will be shared.
185
195
// Use another config variable here, not e.cfg, to not
186
196
// affect main parsing by this parsing of only config option.
187
- initFlagSet (fs , & cfg , e .DBManager )
197
+ initFlagSet (fs , & cfg , e .DBManager , false )
188
198
189
199
// Parse max options, even force version option: don't want
190
200
// to get access to Executor here: it's error-prone to use
0 commit comments