fix(dispatcher): place nolint:gosec on go statement, not inside goroutine

This commit is contained in:
2026-05-22 15:14:07 +07:00
parent 5717d73e5c
commit d5c88afc4f
+3 -4
View File
@@ -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)