Standard library / crypto/x509

crypto/x509.NewCertPool()

Creates an empty trust pool. Add only intentionally trusted certificates. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func NewCertPool() *CertPool

Return Value

*CertPool

Result as described above; check any returned error before use.

Working Example

Example Snippetgo
package main
import (  "crypto/x509"  "fmt")
func main() { fmt.Println(x509.NewCertPool().Equal(x509.NewCertPool())) }
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference