From fca422b28f35af1961313fa1f8675c1ff4f6d516 Mon Sep 17 00:00:00 2001 From: nitroflap Date: Wed, 16 Feb 2022 16:47:30 +0300 Subject: [PATCH] fix(examples): signal.Notify unbuffered channel --- examples/autocomplete/main.go | 4 ++-- examples/slash_commands/main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/autocomplete/main.go b/examples/autocomplete/main.go index 3e509af..55dbc6a 100644 --- a/examples/autocomplete/main.go +++ b/examples/autocomplete/main.go @@ -239,8 +239,8 @@ func main() { log.Fatalf("Cannot register commands: %v", err) } - stop := make(chan os.Signal) - signal.Notify(stop, os.Interrupt) //nolint: staticcheck + stop := make(chan os.Signal, 1) + signal.Notify(stop, os.Interrupt) <-stop log.Println("Gracefully shutting down") diff --git a/examples/slash_commands/main.go b/examples/slash_commands/main.go index 1cb3dea..3a1cf58 100644 --- a/examples/slash_commands/main.go +++ b/examples/slash_commands/main.go @@ -379,7 +379,7 @@ func main() { defer s.Close() - stop := make(chan os.Signal) + stop := make(chan os.Signal, 1) signal.Notify(stop, os.Interrupt) <-stop log.Println("Gracefully shutdowning")