Fix all errcheck linter issues

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-03-15 10:36:35 -07:00
parent 87b7323367
commit d0b1875dbb
13 changed files with 71 additions and 71 deletions

View File

@@ -24,7 +24,7 @@ func setupSeal(t *testing.T) (*Manager, func()) {
}
b := barrier.NewAESGCMBarrier(database)
mgr := NewManager(database, b, slog.Default())
return mgr, func() { database.Close() }
return mgr, func() { _ = database.Close() }
}
func TestSealInitializeAndUnseal(t *testing.T) {
@@ -69,11 +69,11 @@ func TestSealInitializeAndUnseal(t *testing.T) {
func TestSealWrongPassword(t *testing.T) {
mgr, cleanup := setupSeal(t)
defer cleanup()
mgr.CheckInitialized()
_ = mgr.CheckInitialized()
params := crypto.Argon2Params{Time: 1, Memory: 64 * 1024, Threads: 1}
mgr.Initialize(context.Background(), []byte("correct"), params)
mgr.Seal()
_ = mgr.Initialize(context.Background(), []byte("correct"), params)
_ = mgr.Seal()
err := mgr.Unseal([]byte("wrong"))
if !errors.Is(err, ErrInvalidPassword) {
@@ -84,10 +84,10 @@ func TestSealWrongPassword(t *testing.T) {
func TestSealDoubleInitialize(t *testing.T) {
mgr, cleanup := setupSeal(t)
defer cleanup()
mgr.CheckInitialized()
_ = mgr.CheckInitialized()
params := crypto.Argon2Params{Time: 1, Memory: 64 * 1024, Threads: 1}
mgr.Initialize(context.Background(), []byte("password"), params)
_ = mgr.Initialize(context.Background(), []byte("password"), params)
err := mgr.Initialize(context.Background(), []byte("password"), params)
if !errors.Is(err, ErrAlreadyInitialized) {
@@ -101,20 +101,20 @@ func TestSealCheckInitializedPersists(t *testing.T) {
// First: initialize.
database, _ := db.Open(dbPath)
db.Migrate(database)
_ = db.Migrate(database)
b := barrier.NewAESGCMBarrier(database)
mgr := NewManager(database, b, slog.Default())
mgr.CheckInitialized()
_ = mgr.CheckInitialized()
params := crypto.Argon2Params{Time: 1, Memory: 64 * 1024, Threads: 1}
mgr.Initialize(context.Background(), []byte("password"), params)
database.Close()
_ = mgr.Initialize(context.Background(), []byte("password"), params)
_ = database.Close()
// Second: reopen and check.
database2, _ := db.Open(dbPath)
defer database2.Close()
defer func() { _ = database2.Close() }()
b2 := barrier.NewAESGCMBarrier(database2)
mgr2 := NewManager(database2, b2, slog.Default())
mgr2.CheckInitialized()
_ = mgr2.CheckInitialized()
if mgr2.State() != StateSealed {
t.Fatalf("state after reopen: got %v, want Sealed", mgr2.State())
}