Commit 1ca6875
authored
Expliclty set CGO_ENABLED=1 when running go test with race detection. (#1089)
The Go race detector is implemented in C/C++ and requires CGO_ENABLED to work.
However, even if CGO_ENABLED isn't explicitly set, Go assumes CGO_ENABLED=1 by default when:
- C compiler (like gcc) is available
- go env setup allows it (e.g., go env | grep CGO)
This failed on a fresh system without a C compiler.
So if (e.g.,) gcc installed, `go test -race` just quietly uses CGO under the hood.
While this is not needed for local runs, the change makes CGO_ENABLED=1 explicit and
portable (e.g., for containers, CI, or cross compile).
Signed-off-by: Etai Lev Ran <[email protected]>1 parent 5c851eb commit 1ca6875
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
0 commit comments