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/cmd/gorename: unsure how to use -from to specify renaming test #34659

Open
nnathan opened this issue Oct 2, 2019 · 1 comment
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@nnathan
Copy link

nnathan commented Oct 2, 2019

What did you do?

Created a simple package "foo" in $GOPATH/src/foo with a single go file foo_test.go:

package foo_test
const testVal = 5 // note letter t in testVal starts at byte 25

I can successfully rename testVal using the -offset option:

gorename -v -d -offset foo_test.go:#27 -to blah

However I cannot seem to use the -from option because it fails to find the package:

$ gorename -from '"foo_test".testVal' -to blah
gorename: can't find package "foo_test"

What did you expect to see?

I expect to see gorename succeed when using -from on a test package.

I've tried a foo.go containing similar code under package foo, and renaming the symbol using gorename -from is fine.

I'm not sure if I need to specify some kind of testing build tag using the -tags option to get it to examine test packages.

@gopherbot gopherbot added this to the Unreleased milestone Oct 2, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Oct 2, 2019
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 2, 2019
@gopherbot
Copy link

Change https://golang.org/cl/211957 mentions this issue: refactor/rename: add renaming for packages ends with test

@adonovan adonovan added the Refactoring Issues related to refactoring tools label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants