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 {
6161
6262 l .handleGoVersion ()
6363
64- l .handleDeprecation ()
64+ err = l .handleDeprecation ()
65+ if err != nil {
66+ return err
67+ }
6568
6669 err = l .handleEnableOnlyOption ()
6770 if err != nil {
@@ -279,7 +282,7 @@ func (l *Loader) handleGoVersion() {
279282 }
280283}
281284
282- func (l * Loader ) handleDeprecation () {
285+ func (l * Loader ) handleDeprecation () error {
283286 if len (l .cfg .Run .SkipFiles ) > 0 {
284287 l .warn ("The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." )
285288 l .cfg .Issues .ExcludeFiles = l .cfg .Run .SkipFiles
@@ -301,6 +304,20 @@ func (l *Loader) handleDeprecation() {
301304 l .warn ("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`" )
302305 }
303306 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
304321}
305322
306323func (l * Loader ) handleEnableOnlyOption () error {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ var AllOutputFormats = []string{
3535}
3636
3737type Output struct {
38- Format string `mapstructure:"format"`
38+ Format string `mapstructure:"format"` // Deprecated: use Formats instead.
3939 Formats OutputFormats `mapstructure:"formats"`
4040 PrintIssuedLine bool `mapstructure:"print-issued-lines"`
4141 PrintLinterName bool `mapstructure:"print-linter-name"`
You can’t perform that action at this time.
0 commit comments