Fix gosec, govet, and errorlint linter errors
Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package crypto
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -60,7 +61,7 @@ func TestDecryptWrongKey(t *testing.T) {
|
||||
|
||||
ciphertext, _ := Encrypt(key1, plaintext)
|
||||
_, err := Decrypt(key2, ciphertext)
|
||||
if err != ErrDecryptionFailed {
|
||||
if !errors.Is(err, ErrDecryptionFailed) {
|
||||
t.Fatalf("expected ErrDecryptionFailed, got: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -68,7 +69,7 @@ func TestDecryptWrongKey(t *testing.T) {
|
||||
func TestDecryptInvalidCiphertext(t *testing.T) {
|
||||
key, _ := GenerateKey()
|
||||
_, err := Decrypt(key, []byte("short"))
|
||||
if err != ErrInvalidCiphertext {
|
||||
if !errors.Is(err, ErrInvalidCiphertext) {
|
||||
t.Fatalf("expected ErrInvalidCiphertext, got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user