From fad8ed42c010addf192d9bf81d13fa2b053373f6 Mon Sep 17 00:00:00 2001 From: Xiaoxuan Wang Date: Tue, 14 Nov 2023 04:30:32 +0000 Subject: [PATCH] resolve comment Signed-off-by: Xiaoxuan Wang --- content/oci/oci.go | 10 ++++++---- content/oci/oci_test.go | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/content/oci/oci.go b/content/oci/oci.go index 8570e54c..5d4699a1 100644 --- a/content/oci/oci.go +++ b/content/oci/oci.go @@ -44,8 +44,10 @@ import ( type Store struct { // AutoSaveIndex controls if the OCI store will automatically save the index // file when needed. - // - If AutoSaveIndex is set to true, the OCI store will automatically save the - // changes to `index.json` on Tag() and Delete() calls, and when pushing a manifest. + // - If AutoSaveIndex is set to true, the OCI store will automatically save + // the changes to `index.json` when + // 1. pushing a manifest + // 2. calling Tag() or Delete() // - If AutoSaveIndex is set to false, it's the caller's responsibility // to manually call SaveIndex() when needed. // - Default value: true. @@ -61,7 +63,7 @@ type Store struct { // has the exclusive access to Store if a delete operation is underway. Operations // such as Fetch, Push use sync.RLock(), while Delete uses sync.Lock(). sync sync.RWMutex - // indexLock ensures that only one process is writing to the index. + // indexLock ensures that only one go-routine is writing to the index. indexLock sync.Mutex } @@ -141,7 +143,7 @@ func (s *Store) Exists(ctx context.Context, target ocispec.Descriptor) (bool, er // Delete deletes the content matching the descriptor from the store. Delete may // fail on certain systems (i.e. NTFS), if there is a process (i.e. an unclosed -// Reader) using `target`. +// Reader) using target. func (s *Store) Delete(ctx context.Context, target ocispec.Descriptor) error { s.sync.Lock() defer s.sync.Unlock() diff --git a/content/oci/oci_test.go b/content/oci/oci_test.go index c87dae47..048c649d 100644 --- a/content/oci/oci_test.go +++ b/content/oci/oci_test.go @@ -2064,8 +2064,7 @@ func TestStore_FetchAndDelete(t *testing.T) { t.Fatal("error =", err) } if !bytes.Equal(got, content) { - fmt.Println(got) - t.Fatal("wrong content") + t.Errorf("Store.Fetch() = %v, want %v", string(got), string(content)) } rc.Close()