-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/go/analysis/passes/sigchanyzer: alteration of the AST #46129
Comments
|
I created a potential fix: https://go-review.googlesource.com/c/tools/+/319211 |
@bcmills No, the other two passes that require |
Change https://golang.org/cl/319211 mentions this issue: |
It's unclear to me though why modifying AST in one pass (sigchanyzer) will affect the other |
Yes. tl;dr Don't modify the ast from an Analyzer.** Modifying anything reachable from a Pass.Files during an Analyzer.Run(*Pass), let's call this A, races with every Analyzer B where A and B are not related by an Analyzer.Requires field. These are not working on unique copies of the AST for each pass but a shared one for each package.Package loaded. Definition of action.pkg: There is nothing special about buildssa it just happens to be independently runnable from sigchanyzer. ** Unless you know all of the Analyzers being run and are in a Requires relationship to all of them. |
Change https://golang.org/cl/321389 mentions this issue: |
This brings in CLs 312829, 317431, 319211. Fixes #40356. Fixes #46129. Change-Id: I2ee1f858b2a41ffa60d88b0c17511ccad57f1816 Reviewed-on: https://go-review.googlesource.com/c/go/+/321389 Reviewed-by: Dmitri Shuralyov <[email protected]> Trust: Tim King <[email protected]> Run-TryBot: Tim King <[email protected]> TryBot-Result: Go Bot <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes, but the issue is not related to Go itself.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I use go vet passes into golangci-lint.
sigchanyzer
produces an unexpected behavior with thebuildssa.Analyzer
, I think it's because it alters the AST.The problem comes from the following lines:
https://github.com/golang/tools/blob/be4aaae4cf865bd1e65ae3a22df28c1f47b6ccfd/go/analysis/passes/sigchanyzer/sigchanyzer.go#L62-L65
More details here: golangci/golangci-lint#1973
Steps to reproduce: golangci/golangci-lint#1973 (comment)
What did you expect to see?
No impact on the
buildssa.Analyzer
.What did you see instead?
Impact on the
buildssa.Analyzer
.The text was updated successfully, but these errors were encountered: