From a1fc6e69a7c2d6bc54cd00ec8821f72c2296b71f Mon Sep 17 00:00:00 2001 From: 0x1d Date: Wed, 5 Nov 2025 12:24:43 +0100 Subject: [PATCH] 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 --- .github/workflows/ci.yml | 2 ++ Makefile | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d039640..dc21443 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Makefile b/Makefile index 9bf1b47..bff4f9f 100644 --- a/Makefile +++ b/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"