nixpkgs-suyu/pkgs/development/compilers/go/ssl-cert-file-1.16.patch
Colin L Rice 9eb88a2e1d go_1_16: init at 1.16
Changes are minor - I ended up just patching the ssl certs at the root
file, rather than trying to keep up with the various darwin changes.

The externalnetwork test helper location changed, to so I had to update
that patch as well.

- Add xcbuild as propagatedBuildInput on darwin 7e25bdba5e
2021-02-17 06:30:32 +10:00

34 lines
754 B
Diff

diff --git a/src/crypto/x509/root.go b/src/crypto/x509/root.go
index ac92915128..fb1d70c735 100644
--- a/src/crypto/x509/root.go
+++ b/src/crypto/x509/root.go
@@ -6,7 +6,11 @@ package x509
//go:generate go run root_ios_gen.go -version 55161.140.3
-import "sync"
+import (
+ "io/ioutil"
+ "os"
+ "sync"
+)
var (
once sync.Once
@@ -20,6 +24,16 @@ func systemRootsPool() *CertPool {
}
func initSystemRoots() {
+ if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file)
+ if err == nil {
+ roots := NewCertPool()
+ roots.AppendCertsFromPEM(data)
+ systemRoots = roots
+ return
+ }
+ }
+
systemRoots, systemRootsErr = loadSystemRoots()
if systemRootsErr != nil {
systemRoots = nil