Change fmt to errors package for formatting errors

This commit is contained in:
Herman Slatman 2021-05-07 00:22:06 +02:00
parent ff1b46c95d
commit d0a9cbc797
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F
2 changed files with 2 additions and 4 deletions

View file

@ -2,7 +2,6 @@ package provisioner
import ( import (
"context" "context"
"fmt"
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -88,7 +87,7 @@ func (s *SCEP) Init(config Config) (err error) {
} }
if s.MinimumPublicKeyLength%8 != 0 { if s.MinimumPublicKeyLength%8 != 0 {
return fmt.Errorf("only minimum public keys exactly divisible by 8 are supported; %d is not exactly divisibly by 8", s.MinimumPublicKeyLength) return errors.Errorf("only minimum public keys exactly divisible by 8 are supported; %d is not exactly divisibly by 8", s.MinimumPublicKeyLength)
} }
// TODO: add other, SCEP specific, options? // TODO: add other, SCEP specific, options?

View file

@ -8,7 +8,6 @@ import (
"crypto/x509/pkix" "crypto/x509/pkix"
"encoding/asn1" "encoding/asn1"
"encoding/json" "encoding/json"
"fmt"
"net" "net"
"net/url" "net/url"
"reflect" "reflect"
@ -139,7 +138,7 @@ func (v publicKeyMinimumLengthValidator) Valid(req *x509.CertificateRequest) err
case *rsa.PublicKey: case *rsa.PublicKey:
minimumLengthInBytes := v.length / 8 minimumLengthInBytes := v.length / 8
if k.Size() < minimumLengthInBytes { if k.Size() < minimumLengthInBytes {
return fmt.Errorf("rsa key in CSR must be at least %d bits (%d bytes)", v.length, minimumLengthInBytes) return errors.Errorf("rsa key in CSR must be at least %d bits (%d bytes)", v.length, minimumLengthInBytes)
} }
case *ecdsa.PublicKey, ed25519.PublicKey: case *ecdsa.PublicKey, ed25519.PublicKey:
default: default: