You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
gomvpkg should rewrite import comments (https://golang.org/s/go14customimport) next to the package statements (package foo // import "foo")
What version of Go are you using (go version)?
go version go1.4.2 darwin/amd64
What operating system and processor architecture are you using?
OS X 10.10.3
What did you do?
Moved a package using gomvpkg:
mkdir /tmp/foo
export GOPATH=/tmp/foo
go get -u golang.org/x/net/...
mkdir -p $GOPATH/src/go.corp.company.com/x/golang.org/x
gomvpkg -from golang.org/x/net -to go.corp.company.com/x/golang.org/x/net
cd $GOPATH/src/go.corp.company.com/x/golang.org/x/net
go test -v ./...
What did you expect to see?
All tests passed.
What did you see instead?
Lots of errors like this due to the import comments not being rewritten:
Fixing the issue would make it easier to use gomvpkg for vendoring instead of third-party tools or custom hacks (Perl / sed scripts etc.). CC'ing @bradfitz for comments (would be great to try to "dogfood" gomvpkg for camlistore vendoring! 😄 )
I would think that in the rename.move() function, around https://github.com/golang/tools/blob/master/refactor/rename/mvpkg.go#L240
we would need to add the following logic:
is there an import comment next to the package statement with import value matching the "from" parameter? (ex. : package foo // import "github.com/my/foo") If yes, create a new comment node based on the "to" parameter and add it to the AST.
Summary:
gomvpkg should rewrite import comments (https://golang.org/s/go14customimport) next to the package statements (package foo // import "foo")
I also added a test in my fork which now fails but I believe should succeed:
https://github.com/dmitris/tools/compare/custom_import_comments
Fixing the issue would make it easier to use gomvpkg for vendoring instead of third-party tools or custom hacks (Perl / sed scripts etc.). CC'ing @bradfitz for comments (would be great to try to "dogfood" gomvpkg for camlistore vendoring! 😄 )
See https://go-review.googlesource.com/#/c/8969/ for a related discussion of gomvpkg (in the context of updating the Go FAQ and the current pointer to github.com/kr/goven)
The text was updated successfully, but these errors were encountered: