Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ jobs:
uses: protocol/multiple-go-modules@v1.4
env:
GOFLAGS: ${{ format('{0} {1}', env.GOTESTFLAGS, env.GOFLAGS) }}
CGO_ENABLED: ${{ toJSON(fromJSON(steps.config.outputs.json).cgo) != 'false' }}
# go only recognizes CGO_ENABLED values of 0 and 1; anything else
# (e.g. true/false) is ignored in favor of the platform default
CGO_ENABLED: ${{ toJSON(fromJSON(steps.config.outputs.json).cgo) != 'false' && '1' || '0' }}
with:
run: go test ./...
- name: Run tests (32 bit)
Expand All @@ -175,7 +177,7 @@ jobs:
env:
GOARCH: 386
GOFLAGS: ${{ format('{0} {1}', env.GO386FLAGS, env.GOFLAGS) }}
CGO_ENABLED: ${{ toJSON(fromJSON(steps.config.outputs.json).cgo) != 'false' }}
CGO_ENABLED: ${{ toJSON(fromJSON(steps.config.outputs.json).cgo) != 'false' && '1' || '0' }}
with:
run: |
export "PATH=$PATH_386:$PATH"
Expand All @@ -188,7 +190,9 @@ jobs:
uses: protocol/multiple-go-modules@v1.4
env:
GOFLAGS: ${{ format('{0} {1}', env.GORACEFLAGS, env.GOFLAGS) }}
CGO_ENABLED: ${{ toJSON(fromJSON(steps.config.outputs.json).cgo) != 'false' }}
# the race detector requires cgo, even when the repo disables it
# for the regular test runs
CGO_ENABLED: '1'
with:
run: go test -race ./...
- name: Collect coverage files
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ If you want to disable cgo, you can do so by setting `cgo` to `false` in `.githu
"cgo": false
}
```
This applies to the regular and 32-bit test runs. The race detector run always keeps cgo enabled because `go test -race` requires it; set `skipRace` to `true` if your module cannot build with cgo at all.

### Workflow Modification

Expand Down
Loading