name: Race Detector on: workflow_dispatch: {} pull_request: branches: - main jobs: race: name: Run tests with race detector runs-on: ubuntu-latest strategy: matrix: go-version: [1.20.x] steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - name: Cache Go modules uses: actions/cache@v4 with: path: | ~/go/pkg/mod ~/.cache/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Install build tools (for cgo / race detector) run: | sudo apt-get update sudo apt-get install -y build-essential - name: Ensure CGO enabled run: echo "CGO_ENABLED=1" >> $GITHUB_ENV - name: Run tests with race detector run: | go test -race ./... -v