Skip to content

Commit 4754086

Browse files
committed
feat: isolate formatter setting deprecations
1 parent e890bb2 commit 4754086

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pkg/config/loader.go

+15-6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ func (l *Loader) Load(opts LoadOptions) error {
9595
if err != nil {
9696
return err
9797
}
98+
99+
l.handleFormatterDeprecations()
98100
}
99101

100102
l.handleGoVersion()
@@ -429,9 +431,6 @@ func (l *Loader) handleLinterOptionDeprecations() {
429431
if l.cfg.LintersSettings.Gci.LocalPrefixes != "" {
430432
l.log.Warnf("The configuration option `linters.gci.local-prefixes` is deprecated, please use `prefix()` inside `linters.gci.sections`.")
431433
}
432-
if l.cfg.Formatters.Settings.Gci.LocalPrefixes != "" {
433-
l.log.Warnf("The configuration option `formatters.settings.gci.local-prefixes` is deprecated, please use `prefix()` inside `formatters.settings.gci.sections`.")
434-
}
435434

436435
// Deprecated since v1.33.0.
437436
if l.cfg.LintersSettings.Godot.CheckAll != nil {
@@ -442,9 +441,6 @@ func (l *Loader) handleLinterOptionDeprecations() {
442441
if l.cfg.LintersSettings.GoFumpt.LangVersion != "" {
443442
l.log.Warnf("The configuration option `linters.gofumpt.lang-version` is deprecated, please use global `run.go`.")
444443
}
445-
if l.cfg.Formatters.Settings.GoFumpt.LangVersion != "" {
446-
l.log.Warnf("The configuration option `formatters.settings.gofumpt.lang-version` is deprecated, please use global `run.go`.")
447-
}
448444

449445
// Deprecated since v1.47.0
450446
if l.cfg.LintersSettings.Staticcheck.GoVersion != "" {
@@ -543,6 +539,19 @@ func (l *Loader) handleFormatterExclusions() {
543539
})
544540
}
545541
}
542+
func (l *Loader) handleFormatterDeprecations() {
543+
// Deprecated since v1.44.0.
544+
if l.cfg.Formatters.Settings.Gci.LocalPrefixes != "" {
545+
l.log.Warnf("The configuration option `formatters.settings.gci.local-prefixes` is deprecated, " +
546+
"please use `prefix()` inside `formatters.settings.gci.sections`.")
547+
}
548+
549+
// Deprecated since v1.47.0
550+
if l.cfg.Formatters.Settings.GoFumpt.LangVersion != "" {
551+
l.log.Warnf("The configuration option `formatters.settings.gofumpt.lang-version` is deprecated, " +
552+
"please use global `run.go`.")
553+
}
554+
}
546555

547556
func customDecoderHook() viper.DecoderConfigOption {
548557
return viper.DecodeHook(mapstructure.ComposeDecodeHookFunc(

0 commit comments

Comments
 (0)