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: does not rename example functions #21920

Open
takeyourhatoff opened this issue Sep 18, 2017 · 4 comments
Open

x/tools/refactor/rename: does not rename example functions #21920

takeyourhatoff opened this issue Sep 18, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@takeyourhatoff
Copy link

@takeyourhatoff takeyourhatoff commented Sep 18, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go 1.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

What did you do?

https://play.golang.org/p/ibc3hWTjqN

Rename a function

What did you expect to see?

https://play.golang.org/p/U0pdaBJT8j

gorename to rename the function, and to rename the example function, ExampleF.

gorename correctly renames the comment above documenting the function but does not rename the example function. After the rename, the example function is no longer visible in godoc

What did you see instead?

https://play.golang.org/p/aSKw0KKxLH

@gopherbot gopherbot added this to the Unreleased milestone Sep 18, 2017
@agnivade
Copy link
Contributor

@agnivade agnivade commented Jan 5, 2018

Why do you expect ExampleF to be renamed to ExampleG ? You asked F to be renamed, and it did that perfectly.

It correctly renames F in rename.go and also renames the function invocation in rename_test.go. This seems the right behavior to me.

@takeyourhatoff
Copy link
Author

@takeyourhatoff takeyourhatoff commented Jan 5, 2018

You are not wrong, I just think the more useful behaviour would be to rename the example function too so that godoc does not break when you use gorename. I can't think of a situation where you would not want gorename to rename the example function too.

@agnivade
Copy link
Contributor

@agnivade agnivade commented Jan 5, 2018

You can just run gorename again with passing ExampleF to ExampleG. I feel that is the simplest and the correct way.

/cc @bradfitz - does it make sense to rename ExampleF to ExampleG too ?

P.S. - I didnt know who owns gorename. Since you oversee godoc and goimports, so thought of looping you in.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jan 5, 2018

@alandonovan owns gorename. I'll let him decide things.

@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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