Description
This is a go1.9
specific issue. Creating an issue so I can elaborate on the details. I have a fix that I'll apply to go1.9
branch soon.
In Go 1.9, the crypto/x509
package, on macOS, now imports os/user
package:
https://github.com/golang/go/blob/go1.9rc1/src/crypto/x509/root_darwin.go#L19
It didn't do so in Go 1.8:
https://github.com/golang/go/blob/go1.8.3/src/crypto/x509/root_darwin.go#L18
This causes GopherJS on the go1.9
branch at commit cca79e8 to fail when building net/http
with:
$ gopherjs test net/http
os/user: importing "C" is not supported by GopherJS
We don't run net/http
tests in CI right now, because even though the HTTP client works, there are too many tests in HTTP that rely on the server also working, which isn't supported in GopherJS. So we'd have to disable many tests. Maybe we should add a gopherjs build net/http
line instead, to ensure that the package at least builds.
However, that's not the reason CI didn't catch it. The real reason is that this is a macOS-specific issue, it doesn't occur on Linux, because on Linux, crypto/x509
still doesn't import os/user
package. The import is in root_darwin.go
, which is constrained to GOOS=darwin
because of _darwin
suffix in filename.
This issue demonstrates a pretty significant limitation of the current compiler/natives
mechanism to override standard library packages. We're able to override individual identifiers, but if the package happens to import some (no longer needed) packages, that can't be stopped. /cc @neelance However, dealing with that is out of scope and can be considered later.
For now, my fix will be to get os/user
package to build without errors.