read the docs

This commit is contained in:
JackDoan 2026-01-16 12:43:51 -06:00
parent 6c9fa3f342
commit 886141decf

View file

@ -47,15 +47,8 @@ func NewCAPoolFromPEMReader(r io.Reader) (*CAPool, error) {
scanner := bufio.NewScanner(r)
scanner.Split(util.SplitPEM)
for {
ready := scanner.Scan()
if !ready {
break
}
for scanner.Scan() {
pemBytes := scanner.Bytes()
if scanner.Err() != nil {
return nil, scanner.Err()
}
block, rest := pem.Decode(pemBytes)
if len(bytes.TrimSpace(rest)) > 0 {
@ -78,6 +71,9 @@ func NewCAPoolFromPEMReader(r io.Reader) (*CAPool, error) {
return nil, err
}
}
if err := scanner.Err(); err != nil {
return nil, err
}
if expired {
return pool, ErrExpired