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

Issue 153300043: cmd/gomovepkg: a package moving tool.

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by matloob
Modified:
1 week, 6 days ago
Reviewers:
dct555, adonovan
Visibility:
Public.

Description

cmd/gomovepkg: a package moving tool. Currently very rough. It has basic functionality for moving a directory and renaming imports to the directory's subpackages.

Patch Set 1 #

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

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

Total comments: 40

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

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

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

Total comments: 32
Unified diffs Side-by-side diffs Delta from patch set Stats (+754 lines, -2 lines) Patch
A cmd/gomovepkg/main.go View 1 2 3 1 chunk +28 lines, -0 lines 7 comments Download
M go/buildutil/util.go View 1 2 3 4 1 chunk +11 lines, -1 line 0 comments Download
A refactor/movepkg/movepkg.go View 1 2 3 4 5 1 chunk +406 lines, -0 lines 25 comments Download
A refactor/movepkg/movepkg_test.go View 1 2 3 4 5 1 chunk +308 lines, -0 lines 0 comments Download
M refactor/rename/check.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6
adonovan
Looking good. When you say it "doesn't do anything yet", what do you mean? It ...
12 years, 1 month ago (2014-10-21 21:26:45 UTC) #1
matloob
The "doesn' https://codereview.appspot.com/153300043/diff/40001/cmd/gomovepkg/main.go File cmd/gomovepkg/main.go (right): https://codereview.appspot.com/153300043/diff/40001/cmd/gomovepkg/main.go#newcode6 cmd/gomovepkg/main.go:6: // to the package to point to ...
12 years, 1 month ago (2014-10-23 19:13:43 UTC) #2
matloob
I had just forgotten to update the change description. Responded to some comments, added TODOs ...
12 years, 1 month ago (2014-10-23 19:14:33 UTC) #3
adonovan
Let me know if/when you want me to take another look over it. https://codereview.appspot.com/153300043/diff/40001/cmd/gomovepkg/main.go File ...
12 years, 1 month ago (2014-10-23 19:22:20 UTC) #4
adonovan
https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go File cmd/gomovepkg/main.go (right): https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go#newcode13 cmd/gomovepkg/main.go:13: fromFlag = flag.String("from", "", "directory to be moved") "Import ...
11 years, 11 months ago (2014-12-03 20:52:52 UTC) #5
dct555
2 weeks, 2 days ago (2026-11-06 17:14:02 UTC) #6
https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go
File cmd/gomovepkg/main.go (right):

https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go#ne...
cmd/gomovepkg/main.go:13: fromFlag = flag.String("from", "", "directory to be
moved")
On 2014/12/03 20:52:51, adonovan wrote:
> "Import path of package to be moved"

Done.

https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go#ne...
cmd/gomovepkg/main.go:13: fromFlag = flag.String("from", "", "directory to be
moved")
N7On 2014/12/03 20:52:51, adonovan wrote:
> "Import path of package to be moved"

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go#ne...
cmd/gomovepkg/main.go:14: toFlag   = flag.String("to", "", "new location for
directory")
On 2014/12/03 20:52:51, adonovan wrote:
> "Destination import path for package"

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/cmd/gomovepkg/main.go#ne...
cmd/gomovepkg/main.go:25: fmt.Fprintf(os.Stderr, "Error: %s.\n", err)
On 2014/12/03 20:52:51, adonovan wrote:
> "gomovepkg: %s.\n"
> 

Done.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg.go
File refactor/movepkg/movepkg.go (right):

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:1: // TODO(matloob): what happens if the package is
moving across version
On 2014/12/03 20:52:51, adonovan wrote:
> // Package movepkg moves ...
> package movepkg
> 
> // TODO(matloob):
> // - item1
> // - item2
> // - item3
> 
> This section would be a good place for a general description of the package,
its
> concepts and algorithm.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:29: // TODO(matloob): Is this affected by the github
migration?
On 2014/12/03 20:52:51, adonovan wrote:
> All of these can now be:
> 
> "golang.org/x/tools/go/buildutil"
> 
> etc.
> 
> You should also do:
>  % mv code.google.com/p/go.tools golang.org/x/tools
> in your workspace.  You don't need to run any hg commands.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:36: // anything other than directory already
existing that needs to be checked?
On 2014/12/03 20:52:51, adonovan wrote:
> Just a piece of general advice: don't share code for review (no matter how
> unfinished you feel the logic is) without first cleaning up the syntax
(writing
> comments, eliminating cruft, etc).
> 
> Remember, the point of review is to get someone else's brain to help analyze
the
> underlying problem, so make sure the appearance of the code doesn't get in the
> way.  It rarely takes long to clean up a piece of code without changing its
> behaviour, so long as you understand what it does at this moment.  ("TODO"
> comments are fine for things you plan to do later.)

Done.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:48: for _, srcDir := range ctxt.SrcDirs() {
On 2014/12/03 20:52:51, adonovan wrote:
> You can avoid calling SrcDirs by using the logic in refactor/importgraph: you
> need to know the set of direct dependencies anyway, and you should always
design
> applications around the minimal number of I/O calls.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:149: // TODO(matloob): Would it be better to have
the code in move in this
On 2014/12/03 20:52:51, adonovan wrote:
> No, this is fine.  You don't have an iprog until now.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:170: //			pkg/
On 2014/12/03 20:52:51, adonovan wrote:
> FYI: "src/pkg" is now just "src", everywhere.

Done.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:170: //			pkg/
On 2014/12/03 20:52:51, adonovan wrote:
> FYI: "src/pkg" is now just "src", everywhere.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:178: //  Could pkg and pkg/sub exist in the same
importgraph? If they could, pkg/sub
On 2014/12/03 20:52:51, adonovan wrote:
> I would expect that the go/build API operates on the logical, combined
> hierarchy, with all contributions from GOROOT, GOPATH[0], ... GOPATH[n-1]
taken
> into account.  If the implementations don't match that, report a bug.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:178: //  Could pkg and pkg/sub exist in the same
importgraph? If they could, pkg/sub
On 2014/12/03 20:52:51, adonovan wrote:
> I would expect that the go/build API operates on the logical, combined
> hierarchy, with all contributions from GOROOT, GOPATH[0], ... GOPATH[n-1]
taken
> into account.  If the implementations don't match that, report a bug.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:178: //  Could pkg and pkg/sub exist in the same
importgraph? If they could, pkg/sub
On 2014/12/03 20:52:51, adonovan wrote:
> I would expect that the go/build API operates on the logical, combined
> hierarchy, with all contributions from GOROOT, GOPATH[0], ... GOPATH[n-1]
taken
> into account.  If the implementations don't match that, report a bug.

Acknowledged.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:209: // TODO(matloob): figure out how to reuse the
methods from package rename
On 2014/12/03 20:52:51, adonovan wrote:
> Copy/paste (with a comment) is always fine as a starting point, but I'm
starting
> to think that moving at least part of this package into rename is a good idea.

> See below.

Done.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:263: var filesToUpdate = make(map[*ast.File]bool)
On 2014/12/03 20:52:51, adonovan wrote:
> filesToUpdate := 

Done.

https://codereview.appspot.com/153300043/diff/100001/refactor/movepkg/movepkg...
refactor/movepkg/movepkg.go:266: // rename package name of "from" package
(subpackages are not affected)
On 2014/12/03 20:52:51, adonovan wrote:
> // Change the moved package's "package" declaration to its new base name.

Acknowledged.
Sign in to reply to this message.

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