File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,10 @@ func (l *Loader) Load() error {
61
61
62
62
l .handleGoVersion ()
63
63
64
- l .handleDeprecation ()
64
+ err = l .handleDeprecation ()
65
+ if err != nil {
66
+ return err
67
+ }
65
68
66
69
err = l .handleEnableOnlyOption ()
67
70
if err != nil {
@@ -279,7 +282,7 @@ func (l *Loader) handleGoVersion() {
279
282
}
280
283
}
281
284
282
- func (l * Loader ) handleDeprecation () {
285
+ func (l * Loader ) handleDeprecation () error {
283
286
if len (l .cfg .Run .SkipFiles ) > 0 {
284
287
l .warn ("The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." )
285
288
l .cfg .Issues .ExcludeFiles = l .cfg .Run .SkipFiles
@@ -301,6 +304,20 @@ func (l *Loader) handleDeprecation() {
301
304
l .warn ("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`" )
302
305
}
303
306
l .cfg .Output .ShowStats = l .cfg .Run .ShowStats || l .cfg .Output .ShowStats
307
+
308
+ if l .cfg .Output .Format != "" {
309
+ l .warn ("The configuration option `output.format` is deprecated, please use `output.formats`" )
310
+
311
+ var f OutputFormats
312
+ err := f .UnmarshalText ([]byte (l .cfg .Output .Format ))
313
+ if err != nil {
314
+ return fmt .Errorf ("unmarshal output format: %w" , err )
315
+ }
316
+
317
+ l .cfg .Output .Formats = f
318
+ }
319
+
320
+ return nil
304
321
}
305
322
306
323
func (l * Loader ) handleEnableOnlyOption () error {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ var AllOutputFormats = []string{
35
35
}
36
36
37
37
type Output struct {
38
- Format string `mapstructure:"format"`
38
+ Format string `mapstructure:"format"` // Deprecated: use Formats instead.
39
39
Formats OutputFormats `mapstructure:"formats"`
40
40
PrintIssuedLine bool `mapstructure:"print-issued-lines"`
41
41
PrintLinterName bool `mapstructure:"print-linter-name"`
You can’t perform that action at this time.
0 commit comments