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/gomvpkg: Doesn't update import path of subdirectories #9811

Closed
mewmew opened this issue Feb 9, 2015 · 3 comments
Closed

x/tools/cmd/gomvpkg: Doesn't update import path of subdirectories #9811

mewmew opened this issue Feb 9, 2015 · 3 comments

Comments

@mewmew
Copy link
Contributor

mewmew commented Feb 9, 2015

Some import paths are not updated when trying to update the import path of a package containing subdirectories

$ go get code.google.com/p/gographviz
$ gomvpkg -from code.google.com/p/gographviz -to foo
$ go install foo/...
src/foo/analyse.go:18:2: cannot find package "code.google.com/p/gographviz/ast" in any of:
    /home/u/go/src/code.google.com/p/gographviz/ast (from $GOROOT)
    /home/u/goget/src/code.google.com/p/gographviz/ast (from $GOPATH)
src/foo/gographviz.go:23:2: cannot find package "code.google.com/p/gographviz/parser" in any of:
    /home/u/go/src/code.google.com/p/gographviz/parser (from $GOROOT)
    /home/u/goget/src/code.google.com/p/gographviz/parser (from $GOPATH)
src/foo/escape.go:18:2: cannot find package "code.google.com/p/gographviz/scanner" in any of:
    /home/u/go/src/code.google.com/p/gographviz/scanner (from $GOROOT)
    /home/u/goget/src/code.google.com/p/gographviz/scanner (from $GOPATH)
src/foo/escape.go:19:2: cannot find package "code.google.com/p/gographviz/token" in any of:
    /home/u/go/src/code.google.com/p/gographviz/token (from $GOROOT)
    /home/u/goget/src/code.google.com/p/gographviz/token (from $GOPATH)

To work around this issue one may move the subdirectory packages individually, which results in a lot of warnings but works well until the last step.

$ gomvpkg -from code.google.com/p/gographviz/ast -to foo/ast
/home/u/goget/src/code.google.com/p/gographviz/parser/main.go:19:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/parser/main.go:19:2:     conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/parser/tables.go:17:8: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/parser/tables.go:17:8:   conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/parser/parser_test.go:18:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/parser/parser_test.go:18:2:  conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/analyse.go:18:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/analyse.go:18:2:     conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/gographviz.go:22:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/gographviz.go:22:2:  conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/write.go:18:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/write.go:18:2:   conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/bug_test.go:4:2: renaming this imported package name "ast" to "ast"
/home/u/goget/src/code.google.com/p/gographviz/bug_test.go:4:2:     conflicts with imported package name in same block

$ gomvpkg -from code.google.com/p/gographviz/parser -to foo/parser
/home/u/goget/src/code.google.com/p/gographviz/gographviz.go:22:2: renaming this imported package name "parser" to "parser"
/home/u/goget/src/code.google.com/p/gographviz/gographviz.go:22:2:  conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/analysewrite_test.go:18:2: renaming this imported package name "parser" to "parser"
/home/u/goget/src/code.google.com/p/gographviz/analysewrite_test.go:18:2:   conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/bug_test.go:4:2: renaming this imported package name "parser" to "parser"
/home/u/goget/src/code.google.com/p/gographviz/bug_test.go:4:2:     conflicts with imported package name in same block

$ gomvpkg -from code.google.com/p/gographviz/scanner -to foo/scanner
/home/u/goget/src/foo/parser/main.go:19:2: renaming this imported package name "scanner" to "scanner"
/home/u/goget/src/foo/parser/main.go:19:2:  conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/escape.go:18:2: renaming this imported package name "scanner" to "scanner"
/home/u/goget/src/code.google.com/p/gographviz/escape.go:18:2:  conflicts with imported package name in same block

$ gomvpkg -from code.google.com/p/gographviz/token -to foo/token
/home/u/goget/src/foo/ast/ast.go:19:2: renaming this imported package name "token" to "token"
/home/u/goget/src/foo/ast/ast.go:19:2:  conflicts with imported package name in same block
/home/u/goget/src/foo/parser/main.go:19:2: renaming this imported package name "token" to "token"
/home/u/goget/src/foo/parser/main.go:19:2:  conflicts with imported package name in same block
/home/u/goget/src/foo/parser/parser.go:22:8: renaming this imported package name "token" to "token"
/home/u/goget/src/foo/parser/parser.go:22:8:    conflicts with imported package name in same block
/home/u/goget/src/code.google.com/p/gographviz/escape.go:18:2: renaming this imported package name "token" to "token"
/home/u/goget/src/code.google.com/p/gographviz/escape.go:18:2:  conflicts with imported package name in same block
/home/u/goget/src/foo/scanner/scanner.go:20:8: renaming this imported package name "token" to "token"
/home/u/goget/src/foo/scanner/scanner.go:20:8:  conflicts with imported package name in same block

$ gomvpkg -from code.google.com/p/gographviz -to foo
gomvpkg: invalid move destination: foo conflicts with file /home/u/goget/src/foo.

The last step fails since the foo directory already exists. At this point all the import paths are already updated so one may manually move the contents of gographviz to foo. After this step the package successfully builds using the updated import path.

@adg
Copy link
Contributor

adg commented Feb 9, 2015

@alandonovan

@mikioh mikioh changed the title x/tools/cmd/gomvpkg: Doesn't update import path of subdirectories cmd/gomvpkg: Doesn't update import path of subdirectories Feb 9, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gomvpkg: Doesn't update import path of subdirectories x/tools/cmd/gomvpkg: Doesn't update import path of subdirectories Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@alandonovan alandonovan removed their assignment Feb 10, 2016
@alandonovan
Copy link
Contributor

@michaelmatloob

@mewmew
Copy link
Contributor Author

mewmew commented Jan 19, 2017

Close the issue for now as it has remained inactive for more than 6 months.

Anyone with more insight into the current status may re-open the issue or add a comment about the current progress.

@mewmew mewmew closed this as completed Jan 19, 2017
@golang golang locked and limited conversation to collaborators Jan 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants