From 7df612309e5395976cf04aca3134c9c98e49afe3 Mon Sep 17 00:00:00 2001 From: Nick Khyl Date: Thu, 1 May 2025 18:27:13 -0500 Subject: [PATCH] util/ctxlock: remove AssertLocked usage from the example Updates #12614 Signed-off-by: Nick Khyl --- util/ctxlock/doc_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/util/ctxlock/doc_test.go b/util/ctxlock/doc_test.go index a7b03de09..ed909af3d 100644 --- a/util/ctxlock/doc_test.go +++ b/util/ctxlock/doc_test.go @@ -18,25 +18,21 @@ type Resource struct { func (r *Resource) GetFoo(ctx ctxlock.Context) string { defer ctxlock.Lock(ctx, &r.mu).Unlock() // Lock the mutex if not already held. - syncs.AssertLocked(&r.mu) // Panic if mu is still unlocked. return r.foo } func (r *Resource) SetFoo(ctx ctxlock.Context, foo string) { defer ctxlock.Lock(ctx, &r.mu).Unlock() - syncs.AssertLocked(&r.mu) r.foo = foo } func (r *Resource) GetBar(ctx ctxlock.Context) string { defer ctxlock.Lock(ctx, &r.mu).Unlock() - syncs.AssertLocked(&r.mu) return r.bar } func (r *Resource) SetBar(ctx ctxlock.Context, bar string) { defer ctxlock.Lock(ctx, &r.mu).Unlock() - syncs.AssertLocked(&r.mu) r.bar = bar } @@ -44,7 +40,6 @@ func (r *Resource) WithLock(ctx ctxlock.Context, f func(ctx ctxlock.Context)) { // Lock the mutex if not already held, and get a new context. ctx = ctxlock.Lock(ctx, &r.mu) defer ctx.Unlock() - syncs.AssertLocked(&r.mu) f(ctx) // Call the callback with the new context. }