use fmt pkg for Errorf in tls.go

Signed-off-by: James Sheppard <jgsheppa@protonmail.com>
pull/12063/head
James Sheppard 2 years ago
parent 6912766521
commit 84a5643c29

@ -19,6 +19,7 @@ package tlsutil
import (
"crypto/tls"
"crypto/x509"
"fmt"
"os"
"github.com/pkg/errors"
@ -56,11 +57,11 @@ func NewClientTLS(certFile, keyFile, caFile string, insecureSkipTLSverify bool)
func CertPoolFromFile(filename string) (*x509.CertPool, error) {
b, err := os.ReadFile(filename)
if err != nil {
return nil, errors.Errorf("can't read CA file: %v", filename)
return nil, fmt.Errorf("can't read CA file: %v", filename)
}
cp := x509.NewCertPool()
if !cp.AppendCertsFromPEM(b) {
return nil, errors.Errorf("failed to append certificates from file: %s", filename)
return nil, fmt.Errorf("failed to append certificates from file: %s", filename)
}
return cp, nil
}

Loading…
Cancel
Save