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: mod init outside of GOPATH silently fails #31255
Conversation
This PR (HEAD: 47a35bd) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/170697 to see it. Tip: You can toggle comments from me using the |
Message from Gobot Gobot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Emmanuel Odeke: Patch Set 1: (1 comment) Thank you for this change Rens and welcome to the Go project! Great find! I have made suggestions for the commit message
The issue could perhaps be:
as the title and the content to explain what you explained in the previous commit message Running
and once we have the issue number, in the commit message update at the bottom, where
and that should ensure that we never regress. Thank you and I look forward to reviewing your updates! Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
This PR (HEAD: 226e846) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/170697 to see it. Tip: You can toggle comments from me using the |
Message from Rens Rikkerink: Patch Set 6: (1 comment)
I've applied the requested changes, with an additional replacement on the actual implementation of the fix, as it appears there was already a helper method to achieve this, it was just not invoked in this specific case. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Emmanuel Odeke: Patch Set 6: Run-TryBot+1 Code-Review+2 LGTM, thank you Rens! I've blessed this CL but I'll wait for say 2 days for Bryan, Russ and Ian to chime in otherwise the fix looks correct to me. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 6: TryBots beginning. Status page: https://farmer.golang.org/try?commit=b581577d Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 6: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Bryan C. Mills: Patch Set 6: Code-Review-2 The test failures here are real. Both A fix specific to Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
This PR (HEAD: ada1aba) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/170697 to see it. Tip: You can toggle comments from me using the |
Message from Rens Rikkerink: Patch Set 6: I've moved the check from modinit to modcmd, even though it feels a bit off to me as most of the env-var checks happen in the modinit package, and the die function has not been exported. Is hardcopying the error message from the modinit package a desirable method of applying a fix like this? Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Emmanuel Odeke: Patch Set 7: -Code-Review Oh I see, I shall rescind my +2 and defer to Bryan and other's reviews. Sorry for the noise. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Emmanuel Odeke: Patch Set 7: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 7: TryBots beginning. Status page: https://farmer.golang.org/try?commit=cfee6747 Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 7: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 7: TryBot-Result-1 6 of 19 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
This PR (HEAD: b384474) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/170697 to see it. Tip: You can toggle comments from me using the |
Message from Rens Rikkerink: Patch Set 7: Apologies for this latest attempt, hadn't updated the test to reflect the change according with modcmd yet. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Rens Rikkerink: Patch Set 8: Could anybody do me a favour and run trybot? I can't do it myself ^^' Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Emmanuel Odeke: Patch Set 8: Run-TryBot+1
Done Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 8: TryBots beginning. Status page: https://farmer.golang.org/try?commit=8cb49943 Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 8: TryBot-Result+1 TryBots are happy. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Bryan C. Mills: Patch Set 9: Patch Set 8 was rebased Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Bryan C. Mills: Patch Set 9: Run-TryBot+1 Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 9: TryBots beginning. Status page: https://farmer.golang.org/try?commit=7d51264b Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Message from Gobot Gobot: Patch Set 9: TryBot-Result+1 TryBots are happy. Please don’t reply on this GitHub thread. Visit golang.org/cl/170697. |
Running `go mod init` outside of GOPATH with `GO111MODULE=off` silently fails. This behavior was undocumented. This CL makes go mod fail with the error: go: modules disabled by GO111MODULE=off; see 'go help modules' Comparing with already erroring GO111MODULE=<value> conditions: * With GO111MODULE=auto, inside GOPATH: go modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules' * With GO111MODULE=auto outside of GOPATH: go: cannot determine module path for source directory /path/to/dir (outside GOPATH, no import comments) Fixes #31342 Change-Id: I749787d2a8640913c4ac263072d051314d76e778 GitHub-Last-Rev: b384474 GitHub-Pull-Request: #31255 Reviewed-on: https://go-review.googlesource.com/c/go/+/170697 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This PR is being closed because golang.org/cl/170697 has been merged. |
Running
go mod init
outside of GOPATH withGO111MODULE=off
silently fails. This behavior was undocumented.
This CL makes go mod fail with the error:
go: modules disabled by GO111MODULE=off; see 'go help modules'
Comparing with already erroring GO111MODULE= conditions:
go modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'
go: cannot determine module path for source directory /path/to/dir (outside GOPATH, no import comments)
Fixes #31342