root.go 432 B

1234567891011121314151617181920212223
  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package x509
  5. import "sync"
  6. var (
  7. once sync.Once
  8. systemRoots *CertPool
  9. systemRootsErr error
  10. )
  11. func systemRootsPool() *CertPool {
  12. once.Do(initSystemRoots)
  13. return systemRoots
  14. }
  15. func initSystemRoots() {
  16. systemRoots, systemRootsErr = loadSystemRoots()
  17. }