]> Cypherpunks.ru repositories - gostls13.git/commitdiff
crypto/x509: add CertPool.Clone
authorRoland Shoemaker <roland@golang.org>
Wed, 13 Apr 2022 18:49:15 +0000 (11:49 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 13 Apr 2022 19:04:59 +0000 (19:04 +0000)
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>

api/next/35044.txt [new file with mode: 0644]
src/crypto/x509/cert_pool.go

diff --git a/api/next/35044.txt b/api/next/35044.txt
new file mode 100644 (file)
index 0000000..0ed6f2e
--- /dev/null
@@ -0,0 +1 @@
+pkg crypto/x509, method (*CertPool) Clone() *CertPool #35044
\ No newline at end of file
index 266d1ea04a1478736f881b93bf4d90e30c71223c..e9b2c122b96335e212cafd43b04a176453cf1492 100644 (file)
@@ -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()