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.mod cannot be in drive root folder on Windows #51506
Comments
@cwmos, it's possible that this may have been fixed by the change to |
I tried with gotip and there is still the same issue. The error message has changed to:
|
@mattn , you need to build in a subfolder |
I could repro. |
Change https://go.dev/cl/405934 mentions this issue: |
When go.mod is located on root directory, go compiler check the module prefix with |
Change https://go.dev/cl/463178 mentions this issue: |
Change https://go.dev/cl/463176 mentions this issue: |
For #51506. For #50807. Change-Id: I4c0ae85a2103ac4f07351a4f01ce24fa02f03104 Reviewed-on: https://go-review.googlesource.com/c/go/+/463176 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
Confirmed that this appears to be fixed by testing manually on a
(Please let me know if you can reproduce it again at HEAD.) |
Adding a file path separator is incorrect for a file path that may be the root directory on a Unix platform (such as in a container or chroot). Adding a path separator is incorrect for a package path prefix that may be the empty string (as in the "std" module in GOROOT/src). And in both cases, a Join function is arguably clearer and simpler anyway. Fixes golang#51506 (maybe). Change-Id: Id816930811ad5e4d1fbd206cddf219ecd4ad39a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/463178 Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I believe this is the latest stable release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I placed my go.mod file in the root folder of a drive and placed my main package in a subfolder. I then ran "go build" in the subfolder.
What did you expect to see?
I expected my program to compile
What did you see instead?
The go compiler outputed this error:
The text was updated successfully, but these errors were encountered: