go: Respect $NIX_SSL_CERT_FILE

This commit is contained in:
Daiderd Jordan 2017-03-18 19:38:43 +01:00
parent 8565047bdd
commit f36f21c650
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
4 changed files with 10 additions and 10 deletions

View File

@ -105,7 +105,7 @@ stdenv.mkDerivation rec {
patches = patches =
[ ./remove-tools-1.7.patch [ ./remove-tools-1.7.patch
./cacert-1.7.patch ./ssl-cert-file-1.7.patch
./creds-test.patch ./creds-test.patch
# This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
@ -116,7 +116,7 @@ stdenv.mkDerivation rec {
}) })
]; ];
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
GOOS = if stdenv.isDarwin then "darwin" else "linux"; GOOS = if stdenv.isDarwin then "darwin" else "linux";
GOARCH = if stdenv.isDarwin then "amd64" GOARCH = if stdenv.isDarwin then "amd64"

View File

@ -107,7 +107,7 @@ stdenv.mkDerivation rec {
patches = patches =
[ ./remove-tools-1.8.patch [ ./remove-tools-1.8.patch
./cacert-1.8.patch ./ssl-cert-file-1.8.patch
./creds-test.patch ./creds-test.patch
./remove-test-pie-1.8.patch ./remove-test-pie-1.8.patch
@ -119,7 +119,7 @@ stdenv.mkDerivation rec {
}) })
]; ];
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
GOOS = if stdenv.isDarwin then "darwin" else "linux"; GOOS = if stdenv.isDarwin then "darwin" else "linux";
GOARCH = if stdenv.isDarwin then "amd64" GOARCH = if stdenv.isDarwin then "amd64"

View File

@ -13,7 +13,7 @@ index a4b33c7..9700b75 100644
func loadSystemRoots() (*CertPool, error) { func loadSystemRoots() (*CertPool, error) {
roots := NewCertPool() roots := NewCertPool()
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)
@ -36,7 +36,7 @@ index 59b303d..d4a34ac 100644
+ roots = NewCertPool() + roots = NewCertPool()
+ ) + )
+ +
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)
@ -65,7 +65,7 @@ index 7bcb3d6..3986e1a 100644
func loadSystemRoots() (*CertPool, error) { func loadSystemRoots() (*CertPool, error) {
roots := NewCertPool() roots := NewCertPool()
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)

View File

@ -13,7 +13,7 @@ index a4b33c7..9700b75 100644
func loadSystemRoots() (*CertPool, error) { func loadSystemRoots() (*CertPool, error) {
roots := NewCertPool() roots := NewCertPool()
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)
@ -43,7 +43,7 @@ index 66cdb5e..bb28036 100644
numVerified int // number of execs of 'security verify-cert', for debug stats numVerified int // number of execs of 'security verify-cert', for debug stats
) )
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)
@ -67,7 +67,7 @@ index 7bcb3d6..3986e1a 100644
func loadSystemRoots() (*CertPool, error) { func loadSystemRoots() (*CertPool, error) {
roots := NewCertPool() roots := NewCertPool()
+ if file := os.Getenv("SSL_CERT_FILE"); file != "" { + if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
+ data, err := ioutil.ReadFile(file) + data, err := ioutil.ReadFile(file)
+ if err == nil { + if err == nil {
+ roots.AppendCertsFromPEM(data) + roots.AppendCertsFromPEM(data)