From 95b7683561c81b64c903271d721d3f9ba4106767 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 9 May 2024 12:30:54 +0700 Subject: [PATCH] make: set CGO_ENABLED=1 when running "test" task In environment where CGO_ENABLED=0, some tests that require CGO will fail, in example ---- === RUN TestCgoOk level=info msg="[test] ran [/tmp/TestCgoOk3811517097/001/golangci-lint run --internal-cmd-test --allow-parallel-runners --no-config --timeout=3m --enable-all -D nosnakecase --go=1.22 testdata/cgo] in 1.032596905s" run_test.go:111: Error Trace: /home/ms/go/src/git.sr.ht/~shulhan/golangci-lint/test/testshared/runner.go:282 /home/ms/go/src/git.sr.ht/~shulhan/golangci-lint/test/run_test.go:111 Error: Not equal: expected: "" actual : "level=error msg=\"[linters_context] typechecking error: build constraints exclude all Go files in /home/ms/go/src/git.sr.ht/~shulhan/golangci-lint/test/testdata/cgo\"\n" ---- --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 2554acb9c07b..b19cea7fd431 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ clean: # Test test: export GOLANGCI_LINT_INSTALLED = true +test: CGO_ENABLED=1 test: build GL_TEST_RUN=1 ./$(BINARY) run -v GL_TEST_RUN=1 go test -v -parallel 2 ./...