Fix a few more linter warnings and remove GOFLAGS from make lint

This commit is contained in:
max furman 2021-10-08 15:26:01 -04:00
parent 933b40a02a
commit 5fc24c697c
3 changed files with 8 additions and 9 deletions

View file

@ -154,7 +154,7 @@ fmt:
$Q gofmt -l -w $(SRC)
lint:
$Q $(GOFLAGS) LOG_LEVEL=error golangci-lint run --timeout=30m
$Q golangci-lint run --timeout=30m
lintcgo:
$Q LOG_LEVEL=error golangci-lint run --timeout=30m

View file

@ -166,10 +166,10 @@ func (s *privateKey) Delete() error {
return nil
}
func (s *privateKey) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {
func (s *privateKey) Decrypt(rnd io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) {
k, ok := s.Signer.(*rsa.PrivateKey)
if !ok {
return nil, errors.New("key is not an rsa key")
}
return k.Decrypt(rand, msg, opts)
return k.Decrypt(rnd, msg, opts)
}

View file

@ -145,8 +145,7 @@ func (k *PKCS11) CreateKey(req *apiv1.CreateKeyRequest) (*apiv1.CreateKeyRespons
// CreateSigner creates a signer using the key present in the PKCS#11 MODULE signature
// slot.
func (k *PKCS11) CreateSigner(req *apiv1.CreateSignerRequest) (crypto.Signer, error) {
switch {
case req.SigningKey == "":
if req.SigningKey == "" {
return nil, errors.New("createSignerRequest 'signingKey' cannot be empty")
}
@ -204,8 +203,8 @@ func (k *PKCS11) StoreCertificate(req *apiv1.StoreCertificateRequest) error {
}
// DeleteKey is a utility function to delete a key given an uri.
func (k *PKCS11) DeleteKey(uri string) error {
id, object, err := parseObject(uri)
func (k *PKCS11) DeleteKey(u string) error {
id, object, err := parseObject(u)
if err != nil {
return errors.Wrap(err, "deleteKey failed")
}
@ -223,8 +222,8 @@ func (k *PKCS11) DeleteKey(uri string) error {
}
// DeleteCertificate is a utility function to delete a certificate given an uri.
func (k *PKCS11) DeleteCertificate(uri string) error {
id, object, err := parseObject(uri)
func (k *PKCS11) DeleteCertificate(u string) error {
id, object, err := parseObject(u)
if err != nil {
return errors.Wrap(err, "deleteCertificate failed")
}