File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595 key : ${{ matrix.os }}-${{ matrix.go-module }}-${{ hashFiles('**/go.sum') }}
9696 restore-keys : |
9797 ${{ matrix.os }}-${{ matrix.go-module }}-
98+ - name : Synchronise workspace
99+ run : go work sync
100+ working-directory : ${{ matrix.go-module }}
98101 - name : Compute workspace package patterns
99102 id : workspace-packages
100103 shell : pwsh
Original file line number Diff line number Diff line change 4646 with :
4747 go-version : ' 1.25.6'
4848
49+ - name : Compute workspace package patterns
50+ id : workspace-packages
51+ shell : pwsh
52+ run : |
53+ Push-Location "utils"
54+ $work = go work edit -json | ConvertFrom-Json
55+ $patterns = @($work.Use | ForEach-Object { "$($_.DiskPath)/..." })
56+ "patterns=$($patterns -join ' ')" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
57+ Pop-Location
58+
4959 # Initializes the CodeQL tools for scanning.
5060 - name : Initialize CodeQL
5161 uses : github/codeql-action/init@v4.36.1
5767 # queries: ./path/to/local/query, your-org/your-repo/queries@main
5868
5969 - name : Build workspace for analysis
60- run : go test ./... -run TestDoesNotExist
61- working-directory : utils
70+ shell : pwsh
71+ run : |
72+ Push-Location "utils"
73+ $patterns = "${{ steps.workspace-packages.outputs.patterns }}" -split ' '
74+ go test @patterns -run TestDoesNotExist
75+ Pop-Location
6276
6377 - name : Perform CodeQL Analysis
6478 uses : github/codeql-action/analyze@v4.36.1
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ Go module with its own `go.mod`.
1616To run all tests across the workspace:
1717``` bash
1818cd utils
19- go test ./...
19+ go work sync
20+ go test $( go work edit -json | jq -r ' .Use[].DiskPath + "/..."' )
2021```
2122
2223To run tests for a single subproject, run the same command from that subproject
@@ -29,7 +30,8 @@ We use the built-in mock library and use [mockgen](https://github.com/golang/moc
2930To generate mocks:
3031``` bash
3132cd utils
32- go generate ./...
33+ go work sync
34+ go generate $( go work edit -json | jq -r ' .Use[].DiskPath + "/..."' )
3335```
3436
3537We make use of ` go:generate ` comments to instruct which ` mockgen ` commands should be run.
@@ -46,7 +48,8 @@ They come from [golangci-lint](https://golangci-lint.run/). To run this locally:
4648``` bash
4749# Run from utils/ for the workspace or from an individual submodule directory.
4850cd utils
49- golangci-lint run ./...
51+ go work sync
52+ golangci-lint run $( go work edit -json | jq -r ' .Use[].DiskPath + "/..."' )
5053```
5154
5255### Precommit
You can’t perform that action at this time.
0 commit comments