diff --git a/amt_test.go b/amt_test.go index 837ae11..85067f8 100644 --- a/amt_test.go +++ b/amt_test.go @@ -1092,13 +1092,13 @@ func TestForEachParallelTracked(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil { @@ -1144,13 +1144,13 @@ func TestForEachParallelTracked(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil { @@ -1196,13 +1196,13 @@ func TestForEachParallelTracked(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil { @@ -1272,13 +1272,13 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil { @@ -1332,13 +1332,13 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil { @@ -1389,13 +1389,13 @@ func TestForEachParallelTrackedWithNodeSink(t *testing.T) { } } m.Lock() + defer m.Unlock() _, ok := expectedTrails[trailStr] if !ok { return fmt.Errorf("unexpected trail: %s", trailStr) } delete(expectedTrails, trailStr) delete(foundVals, i) - m.Unlock() return nil }) if err != nil {