You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a package and mark it as deprecated. Now create a _test.go file for that package that uses a testing package (eg. if the original package is foo the _test.go file should be in package foo_test, not foo). Import foo from foo_test just like you'd do if you were actually writing a test that can only test the public API.
Run staticcheck ./..., it will complain that the deprecated package is imported, which makes sense because its one package importing another, but since this is a non-importable test package it doesn't make much sense that it would be reported since of course it imports the thing it's testing.
I do not have an example of this that's public, but it can be reproduced with the following files:
$ staticcheck .
../.cache/go-build/06/069c29de2ba9614ca95ffbcd2668d1eef763082e02302139ed99cb8f9f69b34e-d:13:4: "example.net/foo" is deprecated: this package is old. (SA1019)
foo_test.go:6:2: "example.net/foo" is deprecated: this package is old. (SA1019)
This is not limited to external tests but affects normal tests too, as they cause Go to generate files that import the package under test. I'm honestly not sure how more people haven't run into this issue.