Skip to content
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: handle empty gracefully #49625

hyangah opened this issue Nov 17, 2021 · 1 comment

cmd/go: handle empty gracefully #49625

hyangah opened this issue Nov 17, 2021 · 1 comment


Copy link

hyangah commented Nov 17, 2021

What version of Go are you using (go version)?

$ go version
go version devel go1.18-3d7cb23e3d Wed Nov 17 01:56:19 2021 +0000 darwin/amd64

What did you do?

$ git clone

$ go work init
$ cd  tools
$ cat
go 1.18
$ cd tools
$ go list
 go list
panic: in workspace mode, but pruning is not workspace in newRequirements

goroutine 1 [running]:
cmd/go/internal/modload.newRequirements(0x0, {0x0?, 0x0, 0x5?}, 0x0)
	/Users/hakim/sdk/gotip/src/cmd/go/internal/modload/buildlist.go:118 +0x718
cmd/go/internal/modload.LoadModFile({0x16d63e0, 0xc000124000})
	/Users/hakim/sdk/gotip/src/cmd/go/internal/modload/init.go:695 +0x599
cmd/go/internal/modload.LoadPackages({0x16d63e0?, 0xc000124000}, {{0x0, 0x0}, 0xc00025a090, 0x0, {0x0, 0x0}, 0x0, 0x1, ...}, ...)
	/Users/hakim/sdk/gotip/src/cmd/go/internal/modload/load.go:341 +0x1f7
cmd/go/internal/load.PackagesAndErrors({0x16d63e0?, 0xc000124000?}, {0xf?, 0x0?, 0x0?}, {0xc000140010, 0x0, 0x0})
	/Users/hakim/sdk/gotip/src/cmd/go/internal/load/pkg.go:2647 +0x1cb
cmd/go/internal/list.runList({0x16d63e0?, 0xc000124000}, 0xc00019e300?, {0xc000140010?, 0x0, 0x0})
	/Users/hakim/sdk/gotip/src/cmd/go/internal/list/list.go:508 +0x9f3
main.invoke(0x19b2140, {0xc000140010, 0x1, 0x1})
	/Users/hakim/sdk/gotip/src/cmd/go/main.go:218 +0x2ee
	/Users/hakim/sdk/gotip/src/cmd/go/main.go:175 +0x78e

What did you expect to see?

Helpful error message either when running go work init without a directory, or
when running go list in the tools directory that's not included in

Or, maybe operate in mode when running go list from the tools directory.

What did you see instead?


cc @matloob

Copy link

Duplicate of #49591

@seankhliao seankhliao marked this as a duplicate of #49591 Nov 17, 2021
@golang golang locked and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants