Skip to content

Commit 95b7683

Browse files
committed
make: set CGO_ENABLED=1 when running "test" task
In environment where CGO_ENABLED=0, some tests that require CGO will fail, in example ---- <REDACTED> === 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" <REDACTED> ----
1 parent 35eaf60 commit 95b7683

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ clean:
2828

2929
# Test
3030
test: export GOLANGCI_LINT_INSTALLED = true
31+
test: CGO_ENABLED=1
3132
test: build
3233
GL_TEST_RUN=1 ./$(BINARY) run -v
3334
GL_TEST_RUN=1 go test -v -parallel 2 ./...

0 commit comments

Comments
 (0)