mirror of https://github.com/golang/go.git
crypto/x509: add CertPool.Clone
Export the previously private method copy as Clone. Fixes #35044 Change-Id: I5403d6a3b9f344c980c1c89a6823e1a49dcda26b Reviewed-on: https://go-review.googlesource.com/c/go/+/400175 Run-TryBot: Roland Shoemaker <roland@golang.org> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
d65a41329e
commit
9298f604f4
|
|
@ -0,0 +1 @@
|
|||
pkg crypto/x509, method (*CertPool) Clone() *CertPool #35044
|
||||
|
|
@ -77,7 +77,8 @@ func (s *CertPool) cert(n int) (*Certificate, error) {
|
|||
return s.lazyCerts[n].getCert()
|
||||
}
|
||||
|
||||
func (s *CertPool) copy() *CertPool {
|
||||
// Clone returns a copy of s.
|
||||
func (s *CertPool) Clone() *CertPool {
|
||||
p := &CertPool{
|
||||
byName: make(map[string][]int, len(s.byName)),
|
||||
lazyCerts: make([]lazyCert, len(s.lazyCerts)),
|
||||
|
|
@ -109,7 +110,7 @@ func (s *CertPool) copy() *CertPool {
|
|||
// New changes in the system cert pool might not be reflected in subsequent calls.
|
||||
func SystemCertPool() (*CertPool, error) {
|
||||
if sysRoots := systemRootsPool(); sysRoots != nil {
|
||||
return sysRoots.copy(), nil
|
||||
return sysRoots.Clone(), nil
|
||||
}
|
||||
|
||||
return loadSystemRoots()
|
||||
|
|
|
|||
Loading…
Reference in New Issue