go-tools
go-tools copied to clipboard
Make sure we support Go workspaces
- 1 here, any plans on supporting go workspaces?
I am not sure there is anything for us to do here. What is currently not working?
I just converted a project from a single module...
/
| -- go.mod
| -- main.go
| -- more_nested_directories/
...to a multi-module workspace....
/
| -- go.work
| -- modules/
| -- mod_one
| -- go.mod
| -- main.go
| -- more_nested_directories/
| -- mod_two
| -- go.mod
| -- main.go
| -- more_nested_directories/
// go.work
go 1.20
use (
./modules/mod_one/
./modules/mod_two/
)
The command that I previously used, i.e. staticcheck ./...
, was now throwing the following error when invoked from the project root directory:
-: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies (compile)
I couldn't figure out what the error is trying to tell me. What pattern other than ./...
am I supposed to use?
The command that I am using now for the multi-module workspace is as follows:
go list -f '{{.Dir}}/...' -m | xargs staticcheck
I personally have no issues with using this command, but I think it would be nice if the documentation provided some guidance on what users should use in Go workspaces.
Environment
- staticcheck v0.4.3
- go 1.20.1 linux/amd64