From ab174c473618dd3743881cf44e02c2db4d1ecd5f Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 30 Mar 2026 21:05:59 +0000 Subject: *: Fix lints --- object/store/dual/dual_test.go | 14 +++++++++++--- object/store/quarantine.go | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'object/store') diff --git a/object/store/dual/dual_test.go b/object/store/dual/dual_test.go index 9e102734..1d25a775 100644 --- a/object/store/dual/dual_test.go +++ b/object/store/dual/dual_test.go @@ -76,6 +76,7 @@ func fixtureOID(t *testing.T, algo objectid.Algorithm, key string) objectid.Obje t.Helper() meta := fixtureMetadata(t, algo) + hex, ok := meta[key] if !ok { t.Fatalf("missing fixture metadata key %q", key) @@ -93,12 +94,14 @@ func newDualStore(t *testing.T, repo *testgit.TestRepo, algo objectid.Algorithm) t.Helper() objectsRoot := repo.OpenObjectsRoot(t) + looseStore, err := loose.New(objectsRoot, algo) if err != nil { t.Fatalf("loose.New: %v", err) } packRoot := repo.OpenPackRoot(t) + packedStore, err := packed.New(packRoot, algo, packed.Options{WriteRev: true}) if err != nil { t.Fatalf("packed.New: %v", err) @@ -110,7 +113,7 @@ func newDualStore(t *testing.T, repo *testgit.TestRepo, algo objectid.Algorithm) func TestDualReadsWritesAndQuarantine(t *testing.T) { t.Parallel() - testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper head := fixtureOID(t, algo, "head") packBytes := fixtureBytes(t, algo, "nonthin.pack") @@ -138,6 +141,7 @@ func TestDualReadsWritesAndQuarantine(t *testing.T) { } looseContent := []byte("dual quarantine loose object\n") + looseID, err := objectQ.WriteBytesContent(objecttype.TypeBlob, looseContent) if err != nil { t.Fatalf("quarantine.WriteBytesContent: %v", err) @@ -212,14 +216,18 @@ func TestDualReadsWritesAndQuarantine(t *testing.T) { func TestDualQuarantineDiscardDropsBothHalves(t *testing.T) { t.Parallel() - testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper head := fixtureOID(t, algo, "head") packBytes := fixtureBytes(t, algo, "nonthin.pack") repo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true}) store := newDualStore(t, repo, algo) - quarantiner := any(store).(objectstore.Quarantiner) + quarantiner, ok := any(store).(objectstore.Quarantiner) + if !ok { + t.Fatal("expected objectstore.Quarantiner") + } + quarantine, err := quarantiner.BeginQuarantine(objectstore.QuarantineOptions{}) if err != nil { t.Fatalf("BeginQuarantine: %v", err) diff --git a/object/store/quarantine.go b/object/store/quarantine.go index 6db12084..5fa97ee7 100644 --- a/object/store/quarantine.go +++ b/object/store/quarantine.go @@ -1,6 +1,6 @@ package objectstore -// WriterQuarantine represents one quarantined write that accepts both object- +// Quarantine represents one quarantined write that accepts both object- // wise and pack-wise writes. type Quarantine interface { BaseQuarantine @@ -13,7 +13,7 @@ type QuarantineOptions struct { Pack PackQuarantineOptions } -// WriterQuarantiner creates coordinated quarantines that support both object- +// Quarantiner creates coordinated quarantines that support both object- // wise and pack-wise writes. type Quarantiner interface { BeginQuarantine(opts QuarantineOptions) (Quarantine, error) -- cgit v1.3.1-10-gc9f91