From 899edea9cf3a7ae9bc64037b235b4d0ef51736eb Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Thu, 8 Feb 2024 12:24:14 +0545 Subject: [PATCH] fix: loop var in SyncHandlers (#7) --- sync_consumer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sync_consumer.go b/sync_consumer.go index 0d14c38..86ef025 100644 --- a/sync_consumer.go +++ b/sync_consumer.go @@ -82,7 +82,8 @@ func (t *SyncEventConsumer) consumeEvent(ctx Context) (*Event, error) { func SyncHandlers[T Context](fn ...func(ctx T, e Event) error) []SyncEventHandlerFunc { var syncHandlers []SyncEventHandlerFunc - for _, f := range fn { + for i := range fn { + f := fn[i] syncHandler := func(ctx Context, e Event) error { return f(ctx.(T), e) }