google / google/go-cmp

Consider using testing.Testing to prevent non-testing purpose

Open
#378 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.7k
Forks
243
PR merge metrics
No merged PRs in 30d

Description

I followed:
- #373
- #376

I found these comments very interesting:
- https://github.com/google/go-cmp/issues/373#issuecomment-2666363871
- https://github.com/google/go-cmp/issues/373#issuecomment-2676154182

I think [testing.Testing](https://pkg.go.dev/testing#Testing) could be used to prevent the usage of the lib out of test purpose.

I'm unsure about the implementation. A panic seems an option, but we can be more creative.

It might be a breaking change, but why not after all.

It might help to sort out future issues like:
- https://github.com/kubernetes/kubernetes/issues/104821

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.