From 3f5b02d09f0d345c2d6bef83eddbd518e9327276 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 16 Nov 2022 20:24:03 -0500 Subject: [PATCH] cmd/fix: allow cgo commands in tests to fail if 'go build' is not supported testenv.HasCgo reports whether the test binary may have been built with cgo enabled, but having been built with cgo does not necessarily imply that the test can invoke the cgo tool itself. This should fix a test failure on the android builders introduced in CL 450714. Change-Id: I2eed4098736e1cb285ca20bc248b0ab3515f0dea Reviewed-on: https://go-review.googlesource.com/c/go/+/451221 Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Bryan Mills --- src/cmd/fix/main_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/fix/main_test.go b/src/cmd/fix/main_test.go index 837a5d72c7..2b293077d1 100644 --- a/src/cmd/fix/main_test.go +++ b/src/cmd/fix/main_test.go @@ -17,7 +17,7 @@ import ( func init() { // If cgo is enabled, enforce that cgo commands invoked by cmd/fix // do not fail during testing. - if testenv.HasCGO() { + if testenv.HasCGO() && testenv.HasGoBuild() { // The reportCgoError hook is global, so we can't set it per-test // if we want to be able to run those tests in parallel. // Instead, simply set it to panic on error: the goroutine dump -- 2.50.0