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

file in Go build cache being flagged #1034

Closed
elagergren-spideroak opened this issue Jun 11, 2021 · 4 comments
Closed

file in Go build cache being flagged #1034

elagergren-spideroak opened this issue Jun 11, 2021 · 4 comments
Labels
bug waiting-for-feedback Waiting for the user to get back to us

Comments

@elagergren-spideroak
Copy link

$ staticcheck -version
staticcheck 2021.1 (v0.2.0)
$ staticcheck -debug.version
staticcheck 2021.1 (v0.2.0)

Compiled with Go version: go1.16.4
Main module:
	honnef.co/go/[email protected] (sum: h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=)
Dependencies:
	github.com/BurntSushi/[email protected] (sum: h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=)
	golang.org/x/[email protected] (sum: h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=)
	golang.org/x/[email protected] (sum: h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ=)
	golang.org/x/[email protected] (sum: h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8=)
	golang.org/x/[email protected] (sum: h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=)

We have a package with

// Package foo does xyz.
//
// Deprected: foo bar baz.
package foo

Running go run honnef.co/go/tools/cmd/staticcheck ./... over our repo results in

../../../../Library/Caches/go-build/27/27e948b504ebf9b8801ef99c38e4fc3e9cc62114270ba835130b1731d2658508-d:13:2: package acme.corp/foo is deprecated: foo bar baz. (SA1019)

The build cache file is generated by go test and imports acme.corp/foo.

@elagergren-spideroak elagergren-spideroak added bug needs-triage Newly filed issue that needs triage labels Jun 11, 2021
@dominikh dominikh removed the needs-triage Newly filed issue that needs triage label Jun 18, 2021
@dominikh
Copy link
Owner

Can you show me the contents of the file in the cache? Or at least the beginning of it, up to and including the problematic import?

@dominikh dominikh added the waiting-for-feedback Waiting for the user to get back to us label Jun 18, 2021
@SamWhited
Copy link

I am not sure if it's the same, but I'm seeing similar behavior (the file name is a cached file) but what's actually triggering it is a _test.go file with a different package name. Eg. if I have deprecated package foo and a _test.go file that uses the package foo_test that imports foo to test it, staticcheck treats this as if it's an import of the deprecated foo package. This seems wrong to me, because of course the tests import the deprecated package, the whole point is that they test that package until such a time as it gets removed. This may be a separate issue from the fact that it reports the name of the _test.go file as the cached version, though?

@dominikh
Copy link
Owner

dominikh commented Jun 5, 2022

Those would be two separate issues, yes. But if it also triggers this issue then that's at least convenient.

@dominikh
Copy link
Owner

Lacking any feedback from OP I am going to assume that this is the same bug as #1285. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug waiting-for-feedback Waiting for the user to get back to us
Projects
None yet
Development

No branches or pull requests

3 participants