Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ func main() {
Addr: *listenFlag,
Handler: mux,
}
serverCh := make(chan struct{})
go func() {
log.Printf("[INFO] server is listening on %s\n", *listenFlag)
if err := server.ListenAndServe(); err != http.ErrServerClosed {
log.Fatalf("[ERR] server exited with: %s", err)
}
close(serverCh)
}()

signalCh := make(chan os.Signal, 1)
Expand All @@ -89,8 +87,7 @@ func main() {
log.Fatalf("[ERR] failed to shutdown server: %s", err)
}

// If we got this far, it was an interrupt, so don't exit cleanly
os.Exit(2)
os.Exit(0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we changing the exit code from 2 to 0? wouldn't 2 be more appropriate in case you receive events corresponding to os.Interrupt, syscall.SIGTERM ?

The other change does make sense to me. We also don't have any <-serverCh in main.go that would wait for close(serverCh)

}

func httpEcho(v string) http.HandlerFunc {
Expand Down