Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect unnecessary gomock controller Finish call #940

Open
hendrywiranto opened this issue Nov 21, 2023 · 4 comments
Open

detect unnecessary gomock controller Finish call #940

hendrywiranto opened this issue Nov 21, 2023 · 4 comments

Comments

@hendrywiranto
Copy link

Is your feature request related to a problem? Please describe.
As highlighted in https://pkg.go.dev/github.com/golang/mock/gomock#NewController:

New in go1.14+, if you are passing a *testing.T into this function you no longer need to call ctrl.Finish() in your test methods.

Describe the solution you'd like
A linting rule that can flag when we're unnecessarily calling .Finish to gomock controller, when using a Go version of 1.14+.

Describe alternatives you've considered
Submit a new linter to golangci-lint but it seems like 1 linter for this functionality only is overkill

Additional context
Hello, does this linter support checking of a library usage too?
If yes, I would like to open a PR for this

@chavacava
Copy link
Collaborator

Hi @hendrywiranto, thanks for the proposal.

IMO the use case addressed by the proposed rule is quite niche. I'm not convinced it fits in the revive's intent of being general.
I propose to keep this issue open and let users decide if the rule should be added.
Menawhile, if you need this rule for your day-to-day work, you can implement it and use revive as a library (https://github.com/mgechev/revive#using-revive-as-a-library)

@hendrywiranto
Copy link
Author

Hi @chavacava
Thanks for the reply! Understandable 👍
Thanks for the suggestion too, I will look into that
Should we close this issue or keep it open?

@chavacava
Copy link
Collaborator

I propose to keep the issue open and see if some other users manifest interest in the rule you propose. Thanks again!

@hendrywiranto
Copy link
Author

I propose to keep the issue open and see if some other users manifest interest in the rule you propose. Thanks again!

I see
no worries, thanks for responding!

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

No branches or pull requests

2 participants