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

x/tools/refactor/rename: scans entire workspace when renaming internal symbol #12439

Closed
osocurioso opened this issue Sep 1, 2015 · 1 comment
Closed
Assignees
Milestone

Comments

@osocurioso
Copy link
Contributor

@osocurioso osocurioso commented Sep 1, 2015

When renaming a symbol in an internal package, gorename finds and reports buggy packages outside the internal tree:

$ gorename -dryrun -from '"cmd/compile/internal/gc".Node' -to Qux
While scanning Go workspace:
Package "code.google.com/p/draw2d/draw2d/curve": found packages draw2d (arc.go) and curve (cubic_float64.go) in /gopath/src/code.google.com/p/draw2d/draw2d/curve.
Package "github.com/banthar/gl/examples/glfw": found packages glfw (glfw.go) and main (main.go) in /gopath/src/github.com/banthar/gl/examples/glfw.

Scanning the entire workspace seems unnecessary in this case, since symbols in internal packages cannot be imported outside the internal tree.

go version:

go version devel +e92d0d8 Tue Sep 1 16:28:49 2015 +0000 linux/amd64
@alandonovan
Copy link
Contributor

@alandonovan alandonovan commented Feb 10, 2016

Because of Go's embedding mechanism, renaming symbols within internal packages can have effects that are visible to packages outside the "internal" subtree. So, this counterintuitive scan is required.

The oracle does need to be made more robust when scanning the entire workspace, though.

@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.