From 8ad9f9cbeab45887327608f393bb614187e06099 Mon Sep 17 00:00:00 2001 From: Wahid Rizka Fathurrohman <58039870+wahidrizka@users.noreply.github.com> Date: Sat, 19 Sep 2026 13:21:21 +0700 Subject: [PATCH] docs: fix the graceful shutdown example (#4809) The example calls errors.Is but never imports errors, so copying it as written fails to build with "undefined: errors". It also passes an unbuffered channel to signal.Notify, which go vet reports as a misuse: signal delivery is non-blocking, so a signal that arrives before the receive is dropped. --- docs/doc.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/doc.md b/docs/doc.md index b635335e..3f0c94ea 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -2399,6 +2399,7 @@ package main import ( "context" + "errors" "log" "net/http" "os" @@ -2431,7 +2432,7 @@ func main() { // Wait for interrupt signal to gracefully shutdown the server with // a timeout of 5 seconds. - quit := make(chan os.Signal) + quit := make(chan os.Signal, 1) // kill (no param) default send syscall.SIGTERM // kill -2 is syscall.SIGINT // kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it