How to integrate external custom analyzers with golangci-lint without building a custom binary? #6202
Replies: 1 comment
-
| Your message is a copy-paste of a generated message from ChatGPT. I don't appreciate that.
This means that we recommend using the plugin system based on modules.
No
No, because it's already explicitly explained inside the doc. Read the documentation instead of using an AI:
Or ask an AI to get the answer to your AI questions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
The Module Plugin System documentation describes plugin support but does not clearly explain whether external Go modules can be dynamically loaded by the standard golangci-lint binary, or if a custom build is required.
I have developed a collection of 106 custom go/analysis linters hosted on Bitbucket, covering:
These linters are structured as a Go module following the go/analysis framework.
Current Implementation
Module Structure
Plugin Package Implementation
Example Analyzer
Standalone Binary (Working)
✅ This works perfectly as a standalone tool.
Attempted golangci-lint Integration
.golangci.yml Configuration
Result
Expected: Both golangci-lint's built-in linters and all 106 custom analyzers execute.
Actual: Only golangci-lint's built-in linters run. Custom analyzers are not discovered.
Verification
Current Workaround
#!/bin/bash golangci-lint run ./... ./bin/custom-linter ./...This works but requires:
Questions
Dynamic Loading Capability
Can the standard golangci-lint binary dynamically load external Go modules as plugins?
Module Plugin System Definition
What does "Module Plugin System is recommended" mean in practice?
A) A way to structure analyzers that golangci-lint can dynamically import
B) A pattern for organizing code when building a custom golangci-lint binary
C) Something else
Current docs suggest (A), but behavior indicates (B).
Plugin Interface Requirements
Is the
AnalyzerPlugininterface andNew()function sufficient for golangci-lint to discover external plugins?Or are additional steps required?
Comparison Table:
Environment
Related Documentation
Impact
Clarifying this would help teams:
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions