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

Silenced panic on several calls to co Controller.Finish() #239

Open
fedorkanin opened this issue Mar 20, 2025 · 0 comments
Open

Silenced panic on several calls to co Controller.Finish() #239

fedorkanin opened this issue Mar 20, 2025 · 0 comments

Comments

@fedorkanin
Copy link

fedorkanin commented Mar 20, 2025

Actual behavior: If controller.Finish() is called and then also deferred, any following panic is recovered and silently discarded by the controller. Also, no error message is printed regarding several calls to controller.Finish(), which should be called only once.

Expected behavior: I expected the panic to happen and the test to fail, or at least an error message to be printed about multiple calls to controller.Finish().

To Reproduce: Here is a minimal Go Playground example.

Additional Information

The exact return causing the behavior is this one.

I know this is not a completely conventional usage of the library. However, I think it's not nice that the library can silently ignore a panic under certain conditions. Docs also state nothing about the exact side-effects of executing controller.Finish() several times, they just say that it is not idempotent and therefore can only be invoked once. and if you pass a *testing.T into NewController, you no longer need to call ctrl.Finish() in your test methods.

  • gomock mode (reflect or source): source
  • gomock version or git ref: v0.5.0
  • golang version: 1.24
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

1 participant