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
cmd/go: "go get -u" handles internal imports incorrectly #11307
Comments
That is strange. I'm not seeing anything wrong with the current code of
|
Possibly related or the same as #11055. |
I've spent a while chasing this down, and although I didn't have time to resolve it I can pass along some leads: At its heart the problem is that the disallowInternal() logic in cmd/go/pkg.go is sometimes using srcDir == os.Getwd() during validation of internal imports, instead of using the Package.Dir of the parent package. This happens because 'go get -u' loads the imports through func loadPackage() whereas ordinarily imports are loaded through func loadImport() in the same file. At the end of loadPackage() the call to loadImport() is made using cwd (== os.Getwd()) as the srcDir. You can verify this by running 'go get -u' from the target directory where you want to install, and it doesn't complain. |
Regarding the inaccurate import stacks, there is a missing stk.pop() in func download() of src/cmd/go/get.go, between lines 233-234 (go1.5beta1) corresponding to the stk.push() at line 192. Also, the stk.push/pop pair at lines 225-227 are extraneous. |
CL https://golang.org/cl/12028 mentions this issue. |
Go version:
go get github.com/kisielk/errcheck
completes successfully, butgo get -u github.com/kisielk/errcheck
fails with the following error.The text was updated successfully, but these errors were encountered: