diff --git a/plan/storage/memory/localid.go b/plan/storage/memory/localid.go index 838e80a..ece7ba1 100644 --- a/plan/storage/memory/localid.go +++ b/plan/storage/memory/localid.go @@ -38,9 +38,6 @@ func (ml *LocalID) Find(id string) (int, error) { } func (ml *LocalID) FindOrNext(id string) (int, error) { - ml.mutex.Lock() - defer ml.mutex.Unlock() - lid, err := ml.Find(id) switch { case errors.Is(err, storage.ErrNotFound): diff --git a/plan/storage/memory/localid_test.go b/plan/storage/memory/localid_test.go index f750e30..eddaf6f 100644 --- a/plan/storage/memory/localid_test.go +++ b/plan/storage/memory/localid_test.go @@ -45,6 +45,14 @@ func TestLocalID(t *testing.T) { if actLid != 1 { t.Errorf("exp 1, git %v", actLid) } + t.Log("retrieve unknown") + actLid, actErr = repo.FindOrNext("new") + if actErr != nil { + t.Errorf("exp nil, got %v", actErr) + } + if actLid != 2 { + t.Errorf("exp 2, got %v", actLid) + } actIDs, actErr = repo.FindAll() if actErr != nil {