@@ -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 {})
@@ -597,6 +598,8 @@ func (m Manager) GetAllLinterConfigsForPreset(p string) []*linter.Config {
597
598
return ret
598
599
}
599
600
601
+ // loadCustomLinterConfig loads the configuration of private linters.
602
+ // Private linters are dynamically loaded from .so plugin files.
600
603
func (m Manager ) loadCustomLinterConfig (name string , settings config.CustomLinterSettings ) (* linter.Config , error ) {
601
604
analyzer , err := m .getAnalyzerPlugin (settings .Path )
602
605
if err != nil {
@@ -619,6 +622,11 @@ type AnalyzerPlugin interface {
619
622
GetAnalyzers () []* analysis.Analyzer
620
623
}
621
624
625
+ // getAnalyzerPlugin loads a private linter as specified in the config file,
626
+ // loads the plugin from a .so file, and returns the 'AnalyzerPlugin' interface
627
+ // implemented by the private plugin.
628
+ // An error is returned if the private linter cannot be loaded or the linter
629
+ // does not implement the AnalyzerPlugin interface.
622
630
func (m Manager ) getAnalyzerPlugin (path string ) (AnalyzerPlugin , error ) {
623
631
if ! filepath .IsAbs (path ) {
624
632
// resolve non-absolute paths relative to config file's directory
0 commit comments