]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo/internal/testerrors: pass if GOEXPERIMENT=cgocheck2 is set
authorAustin Clements <austin@google.com>
Wed, 31 May 2023 16:32:29 +0000 (12:32 -0400)
committerAustin Clements <austin@google.com>
Thu, 1 Jun 2023 18:30:29 +0000 (18:30 +0000)
commit563556ccc7c4099ac896c87178043b60365d33b5
treea8995689206fab777b86b90edd96dfb5a7ff202f
parent7dc8509c693c6e6dfa7bdcebdb9d62058b14b509
cmd/cgo/internal/testerrors: pass if GOEXPERIMENT=cgocheck2 is set

The tests in this package are meant to check cgocheck and cgocheck2
mode, so they're of course sensitive to whether they're set.
Currently, the test will set GOEXPERIMENT=cgocheck2 for tests of
cgocheck2 mode, but won't *unset* cgocheck2 mode if it's already in
the environment for tests that expect it to be off. This means

  GOEXPERIMENT=cgocheck2 go test cmd/cgo/internal/testerrors

fails.

Fix this by removing cgocheck2 from GOEXPERIMENT if it's set and the
test case expects it to be unset.

Change-Id: If663e41b791fb89df9940bc5356a566e2a54a77a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499557
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/cgo/internal/testerrors/ptr_test.go