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

Dependency on "testing" from "google.golang.org/grpc/experimental/stats" #7568

Closed
aaronbee opened this issue Aug 28, 2024 · 6 comments
Closed
Assignees

Comments

@aaronbee
Copy link

aaronbee commented Aug 28, 2024

What version of gRPC are you using?

v1.66.0

What version of Go are you using (go version)?

v1.22

What operating system (Linux, Windows, …) and version?

N/A

What did you do?

Verified my code didn't depend on "testing" in production binaries.

What did you expect to see?

No production dependency on "testing".

What did you see instead?

$ go list -deps google.golang.org/grpc | grep testing
testing

This comes from

func snapshotMetricsRegistryForTesting(t *testing.T) {

@aaronbee
Copy link
Author

To add a bit more color here, in our repo we check for unexpected dependencies of our binaries. This is done to reduce binary bloat, to avoid side effects of those dependencies (eg. importing "testing" use to register flags that are exposed by the final binary, but this is no longer the case), and just generally to have a cleaner dependency tree.

A dependency we disallow in production binaries is "testing", which is how we noticed that grpc started depending on it.

@purnesh42H purnesh42H self-assigned this Aug 30, 2024
@easwars
Copy link
Contributor

easwars commented Aug 30, 2024

@aaronbee : Thanks for filing this issue. How do you check for unexpected dependencies of your binaries in your repo? Is that something that you can share with us?

@aaronbee
Copy link
Author

We have a small program (that's not open source, sorry) that uses golang.org/x/tools/go/packages to load a package and walk its dependency tree, reporting any uses of forbidden dependencies. Another simple way to this is with go list -deps which will just print out all the dependencies of a package.

@purnesh42H purnesh42H assigned easwars and unassigned purnesh42H Aug 31, 2024
@easwars
Copy link
Contributor

easwars commented Sep 3, 2024

The change to remove the testing dependency got merged in #7579. Now, we need to do a patch release for this, and also need to think about if we want to add something simple like go list -deps google.golang.org/grpc | grep testing to our vet.sh.

@AlekSi
Copy link

AlekSi commented Sep 14, 2024

Do you have any timeline for the patch release?

@AlekSi
Copy link

AlekSi commented Sep 14, 2024

Actually, it was released in 1.66.2. So this issue probably could be closed.

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

No branches or pull requests

4 participants