Closed dagood closed 1 year ago
@qmuntal and I discussed this in Go sync:
nobackend.go
build constraint makes sense no matter what, simply to make sure the condition is always correct. There's no intentional mismatch.To fix the test suite, a few ideas:
go dist test
"in the wild" may not work) or set it in go dist test
as part of the patch.GOEXPERIMENT
s when running those go build
commands.
In https://github.com/microsoft/go/pull/950 I wrote a test/generator that parses the build constraints for each backend and constructs a simple inverse. We could use that code to generate the constraint for
nobackend.go
so that it is always enabled when none of the backends' conditions are met.This could allow "silent" unintended usage of Go crypto.
GOEXPERIMENT=cngcrypto GOOS=linux go build
would not end up using a backend. However, this is in line with some other behavior:GOEXPERIMENT=opensslcrypto GOOS=linux CGO_ENABLED=0 go build
behaves similarly today.It seems to me we should still make sure
GOEXPERIMENT=systemcrypto
never silently uses Go crypto, though. Based on the issues I saw in https://github.com/microsoft/go/pull/950, this might meanGOEXPERIMENT=systemcrypto go tool dist test
won't work (unless we make more test changes), but since systemcrypto is a fairly simple alias, this might be ok.