1 package tlsconfig 2 3 import ( 4 "crypto/x509" 5 "runtime" 6 ) 7 8 // SystemCertPool returns a copy of the system cert pool, 9 // returns an error if failed to load or empty pool on windows. 10 func SystemCertPool() (*x509.CertPool, error) { 11 certpool, err := x509.SystemCertPool() 12 if err != nil && runtime.GOOS == "windows" { 13 return x509.NewCertPool(), nil 14 } 15 return certpool, err 16 } 17