Browse Source

docs: remove unnecessary os.Exit calls at the end of main (#7861)

The main function defers some things that do not run in the "normal" exit case
because we call os.Exit(0) explicitly. Since falling off the end of main does
the same thing, and also permits defers to run, let's do that.
pull/7863/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
75dafaeacc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 2 deletions
  1. +0
    -2
      docs/tutorials/go.md

+ 0
- 2
docs/tutorials/go.md View File

@ -384,7 +384,6 @@ func main() {
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM) signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c <-c
os.Exit(0)
} }
``` ```
@ -425,7 +424,6 @@ defer server.Stop()
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM) signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c <-c
os.Exit(0)
``` ```
## 1.5 Getting Up and Running ## 1.5 Getting Up and Running


Loading…
Cancel
Save