@@ -35,6 +35,7 @@ func NewManager(cfg *config.Config, log logutils.Log) *Manager {
3535 return m
3636}
3737
38+ // WithCustomLinters loads private linters that are specified in the golangci config file.
3839func (m * Manager ) WithCustomLinters () * Manager {
3940 if m .log == nil {
4041 m .log = report .NewLogWrapper (logutils .NewStderrLog ("" ), & report.Data {})
@@ -594,6 +595,8 @@ func (m Manager) GetAllLinterConfigsForPreset(p string) []*linter.Config {
594595 return ret
595596}
596597
598+ // loadCustomLinterConfig loads the configuration of private linters.
599+ // Private linters are dynamically loaded from .so plugin files.
597600func (m Manager ) loadCustomLinterConfig (name string , settings config.CustomLinterSettings ) (* linter.Config , error ) {
598601 analyzer , err := m .getAnalyzerPlugin (settings .Path )
599602 if err != nil {
@@ -616,6 +619,11 @@ type AnalyzerPlugin interface {
616619 GetAnalyzers () []* analysis.Analyzer
617620}
618621
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.
619627func (m Manager ) getAnalyzerPlugin (path string ) (AnalyzerPlugin , error ) {
620628 if ! filepath .IsAbs (path ) {
621629 // resolve non-absolute paths relative to config file's directory
0 commit comments