Open takeyourhatoff opened 7 years ago
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.
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.
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.
@alandonovan owns gorename. I'll let him decide things.
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