lint: enable forbidigo context rules

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-11-19 18:21:44 -08:00
parent c0fd64f4f8
commit e7a53fb829
23 changed files with 81 additions and 63 deletions

View File

@ -61,7 +61,7 @@ func (m *Map) Get(ctx context.Context, keys ...string) (map[string]interface{},
m.mu.Unlock()
select {
case <-ctx.Done():
return nil, ctx.Err()
return nil, context.Cause(ctx)
case <-ch:
m.mu.Lock()
}

View File

@ -34,7 +34,7 @@ func TestTimeout(t *testing.T) {
m.Set("foo", "bar")
ctx, cancel := context.WithTimeout(context.TODO(), 100*time.Millisecond)
ctx, cancel := context.WithTimeoutCause(context.TODO(), 100*time.Millisecond, nil)
defer cancel()
_, err := m.Get(ctx, "bar")