Skip to content

Commit 096c704

Browse files
committed
feat: improve fallback
1 parent 0399fa3 commit 096c704

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pkg/lint/lintersdb/custom_linters.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,23 @@ func (m *Manager) getAnalyzerPlugin(path string, settings any) ([]*analysis.Anal
8585
return nil, err
8686
}
8787

88-
analyzers, errP := lookupPluginNew(plug, settings)
89-
if errP != nil {
90-
// fallback to the old plugin interface.
91-
analyzers, err = lookupAnalyzerPlugin(plug)
92-
if err != nil {
93-
return nil, fmt.Errorf("lookup plugin %s: %w", path, errors.Join(errP, err))
94-
}
88+
analyzers, err := lookupPlugin(plug, settings)
89+
if err != nil {
90+
return nil, fmt.Errorf("lookup plugin %s: %w", path, err)
9591
}
9692

9793
return analyzers, nil
9894
}
9995

100-
func lookupPluginNew(plug *plugin.Plugin, settings any) ([]*analysis.Analyzer, error) {
96+
func lookupPlugin(plug *plugin.Plugin, settings any) ([]*analysis.Analyzer, error) {
10197
symbol, err := plug.Lookup("New")
10298
if err != nil {
103-
return nil, err
99+
analyzers, errP := lookupAnalyzerPlugin(plug)
100+
if err != nil {
101+
return nil, errors.Join(err, errP)
102+
}
103+
104+
return analyzers, nil
104105
}
105106

106107
// The type func cannot be used here, must be the explicit signature.

0 commit comments

Comments
 (0)