-
Notifications
You must be signed in to change notification settings - Fork 18.1k
cmd/go/internal/modload: improve error message for failing to read module listed in go.work #56050
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
Conversation
…dule listed in go.work Run "go build ./x" in this workspace: -- go.work -- use ./y -- x/go.mod -- module x go 1.19 -- x/m.go -- package m It fails with: "go: open /tmp/foo/y/go.mod: no such file or directory". It's unclear where the name "y" comes from. This change will emit error like: "go: cannot load module y named in go.work file: open /tmp/foo/y/go.mod: no such file or directory" It would be better to add the content of the use line to the error. But we don't have that info when the error happens. So we just use the base name of the module directory as the module name.
This PR (HEAD: 5123622) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/438147 to see it. Tip: You can toggle comments from me using the |
Message from Alan Donovan: Patch Set 2: Code-Review+2 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Bryan Mills: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Zeke Lu: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Bryan Mills: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Run "go build ./x" in this workspace: -- go.work -- use ./y -- x/go.mod -- module x go 1.19 -- x/m.go -- package m It fails with: "go: open /tmp/foo/y/go.mod: no such file or directory". It's unclear where the name "y" comes from. This change will emit error like: "go: cannot load module added to go.work file: open /tmp/foo/y/go.mod: no such file or directory"
This PR (HEAD: abd7741) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/438147 to see it. Tip: You can toggle comments from me using the |
Message from Zeke Lu: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Bryan Mills: Patch Set 3: Code-Review+2 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
This PR (HEAD: ec97646) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/438147 to see it. Tip: You can toggle comments from me using the |
Message from Zeke Lu: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Bryan Mills: Patch Set 4: Run-TryBot+1 Auto-Submit+1 Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Gopher Robot: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Gopher Robot: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Gopher Robot: Patch Set 4: TryBot-Result-1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
This PR (HEAD: 410de1b) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/438147 to see it. Tip: You can toggle comments from me using the |
Message from Zeke Lu: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from hopehook: Patch Set 5: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Gopher Robot: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Gopher Robot: Patch Set 5: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from Bryan Mills: Patch Set 5: Run-TryBot+1 Auto-Submit+1 Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
Message from hopehook: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
…dule listed in go.work Run "go build ./x" in this workspace: -- go.work -- use ./y -- x/go.mod -- module x go 1.19 -- x/m.go -- package m It fails with: "go: open /tmp/foo/y/go.mod: no such file or directory". It's unclear where the name "y" comes from. This change will emit error like: "go: cannot load module listed in go.work file: open /tmp/foo/y/go.mod: no such file or directory" Fixes #55952. Change-Id: Ia45dd915e3fbd6e33340f352b3d6235c6c31190b GitHub-Last-Rev: 410de1b GitHub-Pull-Request: #56050 Reviewed-on: https://go-review.googlesource.com/c/go/+/438147 Run-TryBot: hopehook <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
Message from Zeke Lu: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/438147. |
This PR is being closed because golang.org/cl/438147 has been merged. |
…dule listed in go.work Run "go build ./x" in this workspace: -- go.work -- use ./y -- x/go.mod -- module x go 1.19 -- x/m.go -- package m It fails with: "go: open /tmp/foo/y/go.mod: no such file or directory". It's unclear where the name "y" comes from. This change will emit error like: "go: cannot load module listed in go.work file: open /tmp/foo/y/go.mod: no such file or directory" Fixes golang#55952. Change-Id: Ia45dd915e3fbd6e33340f352b3d6235c6c31190b GitHub-Last-Rev: 410de1b GitHub-Pull-Request: golang#56050 Reviewed-on: https://go-review.googlesource.com/c/go/+/438147 Run-TryBot: hopehook <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
Run "go build ./x" in this workspace:
-- go.work --
use ./y
-- x/go.mod --
module x
go 1.19
-- x/m.go --
package m
It fails with: "go: open /tmp/foo/y/go.mod: no such file or directory".
It's unclear where the name "y" comes from.
This change will emit error like: "go: cannot load module listed in
go.work file: open /tmp/foo/y/go.mod: no such file or directory"
Fixes #55952.