Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4304)

Issue 139150044: code review 139150044: cmd/gorename: a precise, type-aware renaming tool for G... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 8 months ago by adonovan
Modified:
9 years, 7 months ago
CC:
gri, Sameer Ajmani, Dominik Honnef, golang-codereviews
Visibility:
Public.

Description

cmd/gorename: a precise, type-aware renaming tool for Go identifiers. See the usage message in main.go for orientation. To the best of my knowledge, the tool implements all required soundness checks, except: - the dynamic behaviour of reflection is obviously undecidable. - it rejects method renamings that change the "implements" relation. It should probably be more aggressive. - actually it only checks the part of the "implements" relation needed for compilation. Understanding the dynamic behaviour of interfaces is obviously undecidable. - a couple of minor gaps are indicated by TODO comments. Also: - Emacs integration. - tests of all safety checks and (some) successful rewrites.

Patch Set 1 #

Patch Set 2 : diff -r b0670ff992964911f0ce10e7fe50aab5829ac8ab https://code.google.com/p/go.tools #

Patch Set 3 : diff -r b0670ff992964911f0ce10e7fe50aab5829ac8ab https://code.google.com/p/go.tools #

Patch Set 4 : diff -r 01f8610e891f7af6ba5a468ff65855aba60c4430 https://code.google.com/p/go.tools #

Patch Set 5 : diff -r 01f8610e891f7af6ba5a468ff65855aba60c4430 https://code.google.com/p/go.tools #

Patch Set 6 : diff -r 01f8610e891f7af6ba5a468ff65855aba60c4430 https://code.google.com/p/go.tools #

Patch Set 7 : diff -r 01f8610e891f7af6ba5a468ff65855aba60c4430 https://code.google.com/p/go.tools #

Total comments: 55

Patch Set 8 : diff -r 223c284e2435f15b967f3e0bf8e6388598e71678 https://code.google.com/p/go.tools #

Total comments: 18

Patch Set 9 : diff -r 223c284e2435f15b967f3e0bf8e6388598e71678 https://code.google.com/p/go.tools #

Patch Set 10 : diff -r 223c284e2435f15b967f3e0bf8e6388598e71678 https://code.google.com/p/go.tools #

Total comments: 13

Patch Set 11 : diff -r 223c284e2435f15b967f3e0bf8e6388598e71678 https://code.google.com/p/go.tools #

Total comments: 4

Patch Set 12 : diff -r 13423edebb30677d71918291b73798dbeeb5f2a7 https://code.google.com/p/go.tools #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2671 lines, -0 lines) Patch
A cmd/gorename/main.go View 1 2 3 4 5 6 7 8 9 1 chunk +137 lines, -0 lines 0 comments Download
A refactor/rename/check.go View 1 2 3 4 5 6 7 8 9 1 chunk +660 lines, -0 lines 0 comments Download
A refactor/rename/rename.el View 1 2 3 4 5 6 7 8 9 10 1 chunk +92 lines, -0 lines 0 comments Download
A refactor/rename/rename.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +331 lines, -0 lines 0 comments Download
A refactor/rename/rename_test.go View 1 2 3 4 5 6 7 8 9 1 chunk +767 lines, -0 lines 0 comments Download
A refactor/rename/spec.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +532 lines, -0 lines 0 comments Download
A refactor/rename/util.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +152 lines, -0 lines 0 comments Download

Messages

Total messages: 19
adonovan
Hello gri@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go.tools
9 years, 8 months ago (2014-09-05 19:53:45 UTC) #1
adonovan
Hello gri@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 8 months ago (2014-09-10 13:44:10 UTC) #2
adonovan
Hello gri@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 8 months ago (2014-09-16 14:04:40 UTC) #3
Sameer Ajmani
Stopping here today. More to do. https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go File cmd/gorename/main.go (right): https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go#newcode17 cmd/gorename/main.go:17: offsetFlag = flag.String("offset", ...
9 years, 8 months ago (2014-09-19 21:03:37 UTC) #4
adonovan
Thanks for the review. https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go File cmd/gorename/main.go (right): https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go#newcode17 cmd/gorename/main.go:17: offsetFlag = flag.String("offset", "", "file ...
9 years, 8 months ago (2014-09-19 21:31:51 UTC) #5
Sameer Ajmani
https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go File cmd/gorename/main.go (right): https://codereview.appspot.com/139150044/diff/120001/cmd/gorename/main.go#newcode93 cmd/gorename/main.go:93: - support renaming the package clause (no object) On ...
9 years, 8 months ago (2014-09-22 14:46:38 UTC) #6
adonovan
Thanks, all done. I've added tests of successful rewrites. They found a bug, now fixed, ...
9 years, 8 months ago (2014-09-22 15:14:28 UTC) #7
adonovan
Hello gri@golang.org, sameer@golang.org, dominik.honnef@gmail.com (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 8 months ago (2014-09-22 17:38:55 UTC) #8
Dominik Honnef
Comments from just reading the code. More might follow once I get gorename up and ...
9 years, 8 months ago (2014-09-22 17:57:04 UTC) #9
Dominik Honnef
https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el File refactor/rename/rename.el (right): https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el#newcode95 refactor/rename/rename.el:95: (replace-regexp-in-string "[\t\n ]*$" This regex replaces all newlines, not ...
9 years, 8 months ago (2014-09-22 18:31:39 UTC) #10
Dominik Honnef
https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el File refactor/rename/rename.el (right): https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el#newcode43 refactor/rename/rename.el:43: (let* ((filename (file-truename buffer-file-name)) Using file-truename here means that ...
9 years, 8 months ago (2014-09-22 18:58:13 UTC) #11
adonovan
Thanks for the review. https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el File refactor/rename/rename.el (right): https://codereview.appspot.com/139150044/diff/180001/refactor/rename/rename.el#newcode23 refactor/rename/rename.el:23: (defcustom go-rename-command (concat (car (go-root-and-paths)) ...
9 years, 8 months ago (2014-09-22 20:12:17 UTC) #12
Dominik Honnef
emacs bits LGTM. gorename LGTM in that it worked for me.
9 years, 8 months ago (2014-09-22 20:23:26 UTC) #13
Sameer Ajmani
LGTM https://codereview.appspot.com/139150044/diff/200001/refactor/rename/spec.go File refactor/rename/spec.go (right): https://codereview.appspot.com/139150044/diff/200001/refactor/rename/spec.go#newcode82 refactor/rename/spec.go:82: [TODO: fix that]. TODO(who) https://codereview.appspot.com/139150044/diff/200001/refactor/rename/spec.go#newcode231 refactor/rename/spec.go:231: var wd ...
9 years, 8 months ago (2014-09-23 13:53:37 UTC) #14
adonovan
Thanks for the review. https://codereview.appspot.com/139150044/diff/200001/refactor/rename/spec.go File refactor/rename/spec.go (right): https://codereview.appspot.com/139150044/diff/200001/refactor/rename/spec.go#newcode82 refactor/rename/spec.go:82: [TODO: fix that]. On 2014/09/23 ...
9 years, 8 months ago (2014-09-23 14:19:00 UTC) #15
adonovan
*** Submitted as https://code.google.com/p/go/source/detail?r=511801758bb9&repo=tools *** cmd/gorename: a precise, type-aware renaming tool for Go identifiers. See ...
9 years, 8 months ago (2014-09-23 14:23:08 UTC) #16
r
"gorename" reads to me like "gore name". why not just call it rename?
9 years, 8 months ago (2014-09-23 14:41:00 UTC) #17
adonovan
'rename' is already present in /usr/bin on the many POSIX systems as a non-standard script ...
9 years, 8 months ago (2014-09-23 15:28:58 UTC) #18
Ralph Corderoy
9 years, 7 months ago (2014-09-24 08:12:10 UTC) #19
Message was sent while issue was closed.
adonovan wrote:
> 'rename' is already present in /usr/bin on the many POSIX systems as a
> non-standard script for renaming files according to a pattern.

(Yes, it's very useful;  rename 's/(\d+)-(\d+)/$2-$1/' *.foo)

I too read "gore".  How about renamego, since that's what it does?

Re-order the examples so the one I'm likely to need is first, not the "for
use by editors" one.

Why are -from and -to needed?  I don't have to "mv -from foo -to bar".
Can't it take positional parameters instead for the common case, with a
flag without argument to say the "from" is a byte location?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b