@@ -71,75 +71,6 @@ func (l *Loader) Load() error {
71
71
return nil
72
72
}
73
73
74
- func (l * Loader ) handleEnableOnlyOption () error {
75
- only , err := l .fs .GetStringSlice ("enable-only" )
76
- if err != nil {
77
- return err
78
- }
79
-
80
- if len (only ) > 0 {
81
- l .cfg .Linters = Linters {
82
- Enable : only ,
83
- DisableAll : true ,
84
- }
85
- }
86
-
87
- return nil
88
- }
89
-
90
- func (l * Loader ) handleGoVersion () {
91
- if l .cfg .Run .Go == "" {
92
- l .cfg .Run .Go = detectGoVersion ()
93
- }
94
-
95
- l .cfg .LintersSettings .Govet .Go = l .cfg .Run .Go
96
-
97
- l .cfg .LintersSettings .ParallelTest .Go = l .cfg .Run .Go
98
-
99
- if l .cfg .LintersSettings .Gofumpt .LangVersion == "" {
100
- l .cfg .LintersSettings .Gofumpt .LangVersion = l .cfg .Run .Go
101
- }
102
-
103
- trimmedGoVersion := trimGoVersion (l .cfg .Run .Go )
104
-
105
- l .cfg .LintersSettings .Gocritic .Go = trimmedGoVersion
106
-
107
- // staticcheck related linters.
108
- if l .cfg .LintersSettings .Staticcheck .GoVersion == "" {
109
- l .cfg .LintersSettings .Staticcheck .GoVersion = trimmedGoVersion
110
- }
111
- if l .cfg .LintersSettings .Gosimple .GoVersion == "" {
112
- l .cfg .LintersSettings .Gosimple .GoVersion = trimmedGoVersion
113
- }
114
- if l .cfg .LintersSettings .Stylecheck .GoVersion != "" {
115
- l .cfg .LintersSettings .Stylecheck .GoVersion = trimmedGoVersion
116
- }
117
- }
118
-
119
- func (l * Loader ) handleDeprecation () {
120
- if len (l .cfg .Run .SkipFiles ) > 0 {
121
- l .warn ("The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." )
122
- l .cfg .Issues .ExcludeFiles = l .cfg .Run .SkipFiles
123
- }
124
-
125
- if len (l .cfg .Run .SkipDirs ) > 0 {
126
- l .warn ("The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`." )
127
- l .cfg .Issues .ExcludeDirs = l .cfg .Run .SkipDirs
128
- }
129
-
130
- // The 2 options are true by default.
131
- if ! l .cfg .Run .UseDefaultSkipDirs {
132
- l .warn ("The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`." )
133
- }
134
- l .cfg .Issues .UseDefaultExcludeDirs = l .cfg .Run .UseDefaultSkipDirs && l .cfg .Issues .UseDefaultExcludeDirs
135
-
136
- // The 2 options are false by default.
137
- if l .cfg .Run .ShowStats {
138
- l .warn ("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`" )
139
- }
140
- l .cfg .Output .ShowStats = l .cfg .Run .ShowStats || l .cfg .Output .ShowStats
141
- }
142
-
143
74
func (l * Loader ) setConfigFile () error {
144
75
configFile , err := l .evaluateOptions ()
145
76
if err != nil {
@@ -319,6 +250,75 @@ func (l *Loader) appendStringSlice(name string, current *[]string) {
319
250
}
320
251
}
321
252
253
+ func (l * Loader ) handleGoVersion () {
254
+ if l .cfg .Run .Go == "" {
255
+ l .cfg .Run .Go = detectGoVersion ()
256
+ }
257
+
258
+ l .cfg .LintersSettings .Govet .Go = l .cfg .Run .Go
259
+
260
+ l .cfg .LintersSettings .ParallelTest .Go = l .cfg .Run .Go
261
+
262
+ if l .cfg .LintersSettings .Gofumpt .LangVersion == "" {
263
+ l .cfg .LintersSettings .Gofumpt .LangVersion = l .cfg .Run .Go
264
+ }
265
+
266
+ trimmedGoVersion := trimGoVersion (l .cfg .Run .Go )
267
+
268
+ l .cfg .LintersSettings .Gocritic .Go = trimmedGoVersion
269
+
270
+ // staticcheck related linters.
271
+ if l .cfg .LintersSettings .Staticcheck .GoVersion == "" {
272
+ l .cfg .LintersSettings .Staticcheck .GoVersion = trimmedGoVersion
273
+ }
274
+ if l .cfg .LintersSettings .Gosimple .GoVersion == "" {
275
+ l .cfg .LintersSettings .Gosimple .GoVersion = trimmedGoVersion
276
+ }
277
+ if l .cfg .LintersSettings .Stylecheck .GoVersion != "" {
278
+ l .cfg .LintersSettings .Stylecheck .GoVersion = trimmedGoVersion
279
+ }
280
+ }
281
+
282
+ func (l * Loader ) handleDeprecation () {
283
+ if len (l .cfg .Run .SkipFiles ) > 0 {
284
+ l .warn ("The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." )
285
+ l .cfg .Issues .ExcludeFiles = l .cfg .Run .SkipFiles
286
+ }
287
+
288
+ if len (l .cfg .Run .SkipDirs ) > 0 {
289
+ l .warn ("The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`." )
290
+ l .cfg .Issues .ExcludeDirs = l .cfg .Run .SkipDirs
291
+ }
292
+
293
+ // The 2 options are true by default.
294
+ if ! l .cfg .Run .UseDefaultSkipDirs {
295
+ l .warn ("The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`." )
296
+ }
297
+ l .cfg .Issues .UseDefaultExcludeDirs = l .cfg .Run .UseDefaultSkipDirs && l .cfg .Issues .UseDefaultExcludeDirs
298
+
299
+ // The 2 options are false by default.
300
+ if l .cfg .Run .ShowStats {
301
+ l .warn ("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`" )
302
+ }
303
+ l .cfg .Output .ShowStats = l .cfg .Run .ShowStats || l .cfg .Output .ShowStats
304
+ }
305
+
306
+ func (l * Loader ) handleEnableOnlyOption () error {
307
+ only , err := l .fs .GetStringSlice ("enable-only" )
308
+ if err != nil {
309
+ return err
310
+ }
311
+
312
+ if len (only ) > 0 {
313
+ l .cfg .Linters = Linters {
314
+ Enable : only ,
315
+ DisableAll : true ,
316
+ }
317
+ }
318
+
319
+ return nil
320
+ }
321
+
322
322
func (l * Loader ) warn (format string ) {
323
323
if l .cfg .InternalTest || l .cfg .InternalCmdTest || os .Getenv (logutils .EnvTestRun ) == "1" {
324
324
return
0 commit comments