-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: GOPROXY using file:// protocol not working on Windows #27698
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
Comments
It looks like you're trying to point GOPROXY at a source tree. That's not how it works. GOPROXY is expected to point at a tree of .zip files and .mod files, not source files. I believe you should be able to point GOPROXY at your module cache, which is This is all more or less explained in the documentation that you linked: https://golang.org/cmd/go/#hdr-Module_proxy_protocol. |
Yes I missed that part:
I am specifically trying to use go modules in an environment where there is no direct internet connection. I was hoping that it would be simple, but no such luck. |
So I've done more testing. I set GOPATH to e.g.
and that didn't work! But, after accidentally making a typo, I discovered that THIS works:
Note the two leading slashes instead of three. Now per my recollection, and Wikipedia supports me here, I'd expect the former to work and the later not to work. So there still seems to be a bug in here somewhere. |
FWIW, |
https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/ does seem to support the triple-slash as canonical. Probably we need to do something more robust to translate the URI path to a file path here: go/src/cmd/go/internal/web2/web.go Lines 231 to 232 in 2db1a7f
(CC @alexbrainman, in case he has any advice on Go idioms to convert Windows URL paths to file paths.) |
https://play.golang.org/p/5uOiwDwU0n4 for reference on the behavior of |
LGTM. You could also look in net/url package - we already have some tests for urls that starts with Alex |
OK, so the URL parser is putting the leading slash in, and on Windows we should take it out if the result passes filepath.IsAbs. |
Change https://golang.org/cl/181037 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11 windows/386
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?GOARCH=386
GOOS=windows
What did you do?
What did you expect to see?
Successfully imported the package and ran the program. This is documented in cmd/go, where it says:
Also from the module wiki:
What did you see instead?
I may be doing something wrong, but the documentation seems to indicate
file:///
is supported.The text was updated successfully, but these errors were encountered: