fix: enable CGO for race detector in tests
- Add CGO_ENABLED=1 to CI test step - Add CGO_ENABLED=1 to Makefile test commands - Fixes: go: -race requires cgo; enable cgo by setting CGO_ENABLED=1
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -34,6 +34,8 @@ jobs:
|
||||
run: go mod verify
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
CGO_ENABLED: 1
|
||||
run: go test -v -race -coverprofile=coverage.out ./...
|
||||
|
||||
- name: Upload coverage
|
||||
|
||||
4
Makefile
4
Makefile
@@ -49,11 +49,11 @@ help:
|
||||
# Development commands
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
$(GO) test -v -race ./...
|
||||
CGO_ENABLED=1 $(GO) test -v -race ./...
|
||||
|
||||
test-coverage:
|
||||
@echo "Running tests with coverage..."
|
||||
$(GO) test -v -race -coverprofile=coverage.out ./...
|
||||
CGO_ENABLED=1 $(GO) test -v -race -coverprofile=coverage.out ./...
|
||||
$(GO) tool cover -html=coverage.out -o coverage.html
|
||||
@echo "Coverage report generated: coverage.html"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user