Skip to content

Fix golangci-lint v2 Module Plugin System support#6

Merged
tomoemon merged 1 commit into
mainfrom
feat-golangci-lint-v2-plugin
Nov 11, 2025
Merged

Fix golangci-lint v2 Module Plugin System support#6
tomoemon merged 1 commit into
mainfrom
feat-golangci-lint-v2-plugin

Conversation

@tomoemon

Copy link
Copy Markdown
Owner

Summary

This PR adds support for golangci-lint v2 Module Plugin System, enabling errstklint to be used as a golangci-lint plugin.

Changes

Plugin Implementation

  • Implement LinterPlugin interface from github.com/golangci/plugin-module-register
  • Register plugin using register.Plugin("errstklint", New) in init()
  • Add BuildAnalyzers() method to return the analyzer
  • Add GetLoadMode() method returning LoadModeTypesInfo (required for type information access)

Dependencies

  • Add github.com/golangci/plugin-module-register v0.1.2

Documentation Updates

  • Update errstklint/README.md with golangci-lint v2 usage instructions
  • Update main README.md with v2 requirement note
  • Include configuration examples for .custom-gcl.yml and .golangci.yml

Testing

Verified with golangci-lint v2.6.1:

$ golangci-lint custom
$ ./custom-gcl run ./...
error.go:77:1: function With returns error but missing defer errstk.Wrap(&err) (errstklint)
...

The plugin successfully detects functions missing defer errstk.Wrap(&err).

Requirements

  • golangci-lint v2.0.0 or later

🤖 Generated with Claude Code

- Implement LinterPlugin interface using plugin-module-register
- Register plugin with register.Plugin() in init()
- Add BuildAnalyzers() and GetLoadMode() methods
- Use LoadModeTypesInfo for type information access
- Update documentation for golangci-lint v2 usage
- Add dependency on github.com/golangci/plugin-module-register

This enables errstklint to work as a golangci-lint v2 module plugin,
allowing users to integrate it via golangci-lint custom command.
@tomoemon tomoemon changed the title Add golangci-lint v2 Module Plugin System support Fix golangci-lint v2 Module Plugin System support Nov 11, 2025
@tomoemon
tomoemon merged commit e9d53c2 into main Nov 11, 2025
1 check passed
@tomoemon
tomoemon deleted the feat-golangci-lint-v2-plugin branch November 11, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant