Create a go.work file in your repository root to link multiple Go modules into a single workspace.
- Initialize the workspace file with the default Go version.
go work init - Add your local modules to the workspace using their relative paths.
go work use ./cmd ./pkg ./internal - Verify the workspace configuration by listing the included modules.
go work sync
This setup allows you to run go build or go test across all linked modules simultaneously while resolving local imports correctly.