Skip to content
Myr

docs: fix the graceful shutdown example (#4809)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Wahid Rizka Fathurrohman · committed by GitHub · parent b1f77cf · Browse files · 1 file+2 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−1 removed

  • other:+2 added−1 removed

1 file+2 added−1 removed

modified:docs/doc.md+2 added-1 removed
2397 unmodified lines
2398package main23992400import (2401 "context"2402 "errors"2403 "log"2404 "net/http"2405 "os"2406 "os/signal"
24 unmodified lines
2431 }()24322433 // Wait for interrupt signal to gracefully shutdown the server with2434 // a timeout of 5 seconds.2434 quit := make(chan os.Signal)2435 quit := make(chan os.Signal, 1)2436 // kill (no param) default send syscall.SIGTERM2437 // kill -2 is syscall.SIGINT2438 // kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it2439 signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
269 unmodified lines