Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
x/tools/cmd/gorename: analysis of variable usage differs from go build #14596
gorename reports a variable as being unused when the variable is assigned in a closure. go build will compile the code without complaining.
Error reported by gorename:
Can reproduce with code like this:
go version go1.6 linux/amd64
This renders gorename unusable if any of the GOPATH contains this pattern of code, even though it compiles fine with the go command.
Because go/types is slightly more strict than gc about certain "soft" errors (ones that aren't necessary to interpret a Go program), gorename rejects programs that compile under gc. This change relaxes gorename's error checks so that they are weaker than gc's. This is a workaround for issue golang/go#14596 in gorename, whose underlying problem is issue golang/go#8560 in gc. Fixes golang/go#14596 Change-Id: Ica5006c2376c0564a575224269093c1497348ee6 Reviewed-on: https://go-review.googlesource.com/29853 Reviewed-by: Brad Fitzpatrick <email@example.com>