Fix gosec, govet, and errorlint linter errors
Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package seal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -75,7 +76,7 @@ func TestSealWrongPassword(t *testing.T) {
|
||||
mgr.Seal()
|
||||
|
||||
err := mgr.Unseal([]byte("wrong"))
|
||||
if err != ErrInvalidPassword {
|
||||
if !errors.Is(err, ErrInvalidPassword) {
|
||||
t.Fatalf("expected ErrInvalidPassword, got: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -89,7 +90,7 @@ func TestSealDoubleInitialize(t *testing.T) {
|
||||
mgr.Initialize(context.Background(), []byte("password"), params)
|
||||
|
||||
err := mgr.Initialize(context.Background(), []byte("password"), params)
|
||||
if err != ErrAlreadyInitialized {
|
||||
if !errors.Is(err, ErrAlreadyInitialized) {
|
||||
t.Fatalf("expected ErrAlreadyInitialized, got: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -121,13 +122,13 @@ func TestSealCheckInitializedPersists(t *testing.T) {
|
||||
|
||||
func TestSealStateString(t *testing.T) {
|
||||
tests := []struct {
|
||||
state ServiceState
|
||||
want string
|
||||
state ServiceState
|
||||
}{
|
||||
{StateUninitialized, "uninitialized"},
|
||||
{StateSealed, "sealed"},
|
||||
{StateInitializing, "initializing"},
|
||||
{StateUnsealed, "unsealed"},
|
||||
{want: "uninitialized", state: StateUninitialized},
|
||||
{want: "sealed", state: StateSealed},
|
||||
{want: "initializing", state: StateInitializing},
|
||||
{want: "unsealed", state: StateUnsealed},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
if got := tt.state.String(); got != tt.want {
|
||||
|
||||
Reference in New Issue
Block a user