From 4f7a6d17f01ba10f2f4e94e68cb525001c707f2e Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 22 May 2026 15:14:07 +0700 Subject: [PATCH] fix(dispatcher): place nolint:gosec on go statement, not inside goroutine --- internal/modules/dispatcher.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/modules/dispatcher.go b/internal/modules/dispatcher.go index 64ca910..4b986e6 100644 --- a/internal/modules/dispatcher.go +++ b/internal/modules/dispatcher.go @@ -67,10 +67,9 @@ func Install(b *bot.Bot, reg *Registry, auth Auth) { return // silent — do not leak existence of gated commands } metrics.IncCommand(cmdCopy.Name) - go func() { - // context.Background is intentional: the hook must outlive the request - // context so stats writes complete even after the handler returns. - //nolint:gosec // G118: goroutine intentionally detached from request context + // context.Background is intentional: the hook must outlive the request + // context so stats writes complete even after the handler returns. + go func() { //nolint:gosec // G118: goroutine intentionally detached from request context hookCtx, cancel := context.WithTimeout(context.Background(), 2*time.Second) defer cancel() reg.RunCommandHooks(hookCtx, cmdCopy.Name)