Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

deprecation of Controller.Finish breaks certain test frameworks #81

Closed
marten-seemann opened this issue Sep 11, 2023 · 1 comment
Closed

Comments

@marten-seemann
Copy link
Contributor

Actual behavior

When using the Ginkgo test framework, there's only a single TestXXX function. This function call all other test functions written in the Ginkgo framework. When using gomock, users will need to manually call the gomock.Controller.Finish method after each test.

Expected behavior

gomock.Controller.Finish needs to be available, and needs to remain so in the future. #50 deprecated this function, which makes staticcheck emit errors on my test code. That's ok (I can add nolint directives), but I'm worried that the deprecation is a first step to an eventual remove of Finish, which would break my entire test setup in quic-go. (For the record, I'm not happy with Ginkgo, but that's what we're stuck with for the moment, see quic-go/quic-go#3652).

Given that there are valid use cases of Finish, the function should probably not deprecated at all. Instead, documentation could be added explaining that usually (i.e. when not using any test framework) it's not necessary to call that function.

Additional Information

  • gomock mode (reflect or source): both
  • gomock version or git ref: 837f20a
  • golang version: Go 1.21.1

Triage Notes for the Maintainers

@sywhang
Copy link
Contributor

sywhang commented Sep 12, 2023

Hey @marten-seemann , thanks for raising this issue.

I believe we have a disagreement on what marking an API as Deprecated entails:

From https://github.com/golang/go/wiki/Deprecated:

In contrast to some other systems, an API feature being deprecated does not mean it is going to be removed in the future.

We merged #50 because we believe that calling ctrl.Finish being no-op means we should discourage users from calling that all the time. We get that it creates inconvenience with linters, etc., but it is a step towards the right direction.

I want to reiterate that marking this as deprecated does not mean that we will be eventually removing it. That is a breaking change, and we don't want to make any breaking changes to any of the public APIs of gomock.

@uber-go uber-go locked and limited conversation to collaborators Sep 12, 2023
@sywhang sywhang converted this issue into discussion #84 Sep 12, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants