@@ -8,13 +8,16 @@ import (
88)
99
1010type Manager struct {
11- nameToLCs map [string ][]* linter.Config
12- cfg * config.Config
13- log logutils.Log
11+ cfg * config.Config
12+ log logutils.Log
13+
14+ nameToLCs map [string ][]* linter.Config
15+ customLinters []* linter.Config
1416}
1517
1618func NewManager (cfg * config.Config , log logutils.Log ) * Manager {
1719 m := & Manager {cfg : cfg , log : log }
20+ m .customLinters = m .getCustomLinterConfigs ()
1821
1922 nameToLCs := make (map [string ][]* linter.Config )
2023 for _ , lc := range m .GetAllSupportedLinterConfigs () {
@@ -247,9 +250,12 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
247250
248251 const megacheckName = "megacheck"
249252
253+ var linters []* linter.Config
254+ linters = append (linters , m .customLinters ... )
255+
250256 // The linters are sorted in the alphabetical order (case-insensitive).
251257 // When a new linter is added the version in `WithSince(...)` must be the next minor version of golangci-lint.
252- return [] * linter. Config {
258+ linters = append ( linters ,
253259 linter .NewConfig (golinters .NewAsasalint (asasalintCfg )).
254260 WithSince ("1.47.0" ).
255261 WithPresets (linter .PresetBugs ).
@@ -867,18 +873,20 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
867873 WithPresets (linter .PresetStyle ).
868874 WithURL ("https://github.com/bombsimon/wsl" ),
869875
876+ linter .NewConfig (golinters .NewZerologLint ()).
877+ WithSince ("v1.53.0" ).
878+ WithPresets (linter .PresetBugs ).
879+ WithLoadForGoAnalysis ().
880+ WithURL ("https://github.com/ykadowak/zerologlint" ),
881+
870882 // nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
871883 linter .NewConfig (golinters .NewNoLintLint (noLintLintCfg )).
872884 WithSince ("v1.26.0" ).
873885 WithPresets (linter .PresetStyle ).
874886 WithURL ("https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md" ),
887+ )
875888
876- linter .NewConfig (golinters .NewZerologLint ()).
877- WithSince ("v1.53.0" ).
878- WithPresets (linter .PresetBugs ).
879- WithLoadForGoAnalysis ().
880- WithURL ("https://github.com/ykadowak/zerologlint" ),
881- }
889+ return linters
882890}
883891
884892func (m Manager ) GetAllEnabledByDefaultLinters () []* linter.Config {
0 commit comments