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: improve error message when working in a module that's outside of go.work #49632

Open
hyangah opened this issue Nov 17, 2021 · 1 comment
Open
Assignees
Milestone

Comments

@hyangah
Copy link
Contributor

@hyangah hyangah commented Nov 17, 2021

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

When running a go command in a directory whose parent directory defines go.work but does not include this directory in its use section, the go command output is rather confusing.

$ ls
delve
go.work
tools
$ cat go.work
go 1.18

use delve
$ cd tools; go list ./...
pattern ./...: directory prefix . outside available modules

Even though users can check go env GOWORK, consider to explicitly mention the existence of go.work.
(maybe something like pattern ./...: directory prefix . outside modules listed in go.work?)

Or, let it operate in a single module mode as if there is no go.work - but not sure which one is less confusing.

@bcmills
Copy link
Member

@bcmills bcmills commented Nov 17, 2021

Loading

@bcmills bcmills added this to the Go1.18 milestone Nov 17, 2021
@matloob matloob self-assigned this Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants