@@ -35,6 +35,7 @@ func NewManager(cfg *config.Config, log logutils.Log) *Manager {
35
35
return m
36
36
}
37
37
38
+ // WithCustomLinters loads private linters that are specified in the golangci config file.
38
39
func (m * Manager ) WithCustomLinters () * Manager {
39
40
if m .log == nil {
40
41
m .log = report .NewLogWrapper (logutils .NewStderrLog ("" ), & report.Data {})
@@ -594,6 +595,8 @@ func (m Manager) GetAllLinterConfigsForPreset(p string) []*linter.Config {
594
595
return ret
595
596
}
596
597
598
+ // loadCustomLinterConfig loads the configuration of private linters.
599
+ // Private linters are dynamically loaded from .so plugin files.
597
600
func (m Manager ) loadCustomLinterConfig (name string , settings config.CustomLinterSettings ) (* linter.Config , error ) {
598
601
analyzer , err := m .getAnalyzerPlugin (settings .Path )
599
602
if err != nil {
@@ -616,6 +619,11 @@ type AnalyzerPlugin interface {
616
619
GetAnalyzers () []* analysis.Analyzer
617
620
}
618
621
622
+ // getAnalyzerPlugin loads a private linter as specified in the config file,
623
+ // loads the plugin from a .so file, and returns the 'AnalyzerPlugin' interface
624
+ // implemented by the private plugin.
625
+ // An error is returned if the private linter cannot be loaded or the linter
626
+ // does not implement the AnalyzerPlugin interface.
619
627
func (m Manager ) getAnalyzerPlugin (path string ) (AnalyzerPlugin , error ) {
620
628
if ! filepath .IsAbs (path ) {
621
629
// resolve non-absolute paths relative to config file's directory
0 commit comments