If there are no certs, return an empty pool, not nil.
Fixes #21405
Change-Id: Ib4ac9d5c4a8cef83dd53565b0707a63b73ba0a8b
Reviewed-on: https://go-review.googlesource.com/103596
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
bestErr = err
}
}
+ if bestErr == nil {
+ return roots, nil
+ }
return nil, bestErr
}
}
}
- if len(roots.certs) > 0 {
+ if len(roots.certs) > 0 || firstErr == nil {
return roots, nil
}
}
if r == nil {
- if tc.cns == nil {
- // Expected nil
- return
- }
t.Fatal("nil roots")
}
if runtime.GOOS == "windows" {
t.Skip("not implemented on Windows; Issue 16736, 18609")
}
- if runtime.GOOS == "nacl" {
- t.Skip("not implemented on NaCl; Issue 24561")
- }
a, err := SystemCertPool()
if err != nil {
t.Fatal(err)