go: -race requires cgo; enable cgo by setting CGO_ENABLED=1

1 개요[ | ]

go: -race requires cgo; enable cgo by setting CGO_ENABLED=1

2 예시 1[ | ]

root@wsl:~/go/src/hello# go test -race ./...
go: -race requires cgo; enable cgo by setting CGO_ENABLED=1
root@wsl:~/go/src/hello# CGO_ENABLED=1 go test -race ./...
# runtime/cgo
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
...
FAIL

3 예시 2[ | ]

root@wsl:~/go/src/github.com/testuser/hello# make test_with_race
CGO_ENABLED=0 GO111MODULE=on go test -race
go: -race requires cgo; enable cgo by setting CGO_ENABLED=1
make: *** [Makefile:13: test_with_race] Error 2
root@wsl:~/go/src/github.com/testuser/hello# cat Makefile | grep test_with_race -A1
test_with_race:
        CGO_ENABLED=0 GO111MODULE=on go test -race

4 조치[ | ]

test_with_race:
        CGO_ENABLED=1 GO111MODULE=on go test -race

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}