Skip to content

ci: Add lint rule that ensures a mutex guards "AlreadyLocked" functions#4456

Draft
johnsaigle wants to merge 3 commits into
wormhole-foundation:mainfrom
johnsaigle:revive-wormhole
Draft

ci: Add lint rule that ensures a mutex guards "AlreadyLocked" functions#4456
johnsaigle wants to merge 3 commits into
wormhole-foundation:mainfrom
johnsaigle:revive-wormhole

Conversation

@johnsaigle

Copy link
Copy Markdown
Contributor

Implements a custom rule using the revive linter framework. (Ordinarily revive could be added and configured in the usual golangci-lint way but not if you use custom rules.)

This is done by creating a thin binary wrapper around the revive CLI in accordance with their official documentation. (https://github.com/mgechev/revive/tree/master?tab=readme-ov-file#using-revive-as-a-library)

This specific rule checks that the use of our *AlreadyLocked functions are only called when a mutex is locked within the same function scoped. This should help us protect against data corruption issues for parallel access to e.g. the database.

This PR also adds documentation and linting configuration so that we can continue to extend revive if we want and easily incorporate it into our existing lint set-up.

@johnsaigle johnsaigle changed the title ci: Add custom revive lint rules ci: Add lint rule that ensures a mutex guards "AlreadyLocked" functions Aug 1, 2025
@johnsaigle johnsaigle marked this pull request as ready for review August 14, 2025 20:28
@johnsaigle johnsaigle marked this pull request as draft June 1, 2026 14:08
@johnsaigle

Copy link
Copy Markdown
Contributor Author

This will be refactored into the infrastructure created by #4841

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant