func main() {
http.Handle("/", http.FileServer(http.Dir("./")))
http.ListenAndServe(":8080", nil)
}https://talks.godoc.org/github.com/davecheney/go-1.8-release-party/presentation.slide#36
func (srv *Server) Shutdown(ctx context.Context) error
Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first closing all open listeners, then closing all idle connections, and then waiting indefinitely for connections to return to idle and then shut down. If the provided context expires before the shutdown is complete, then the context's error is returned.
Shutdown does not attempt to close nor wait for hijacked connections such as WebSockets. The caller of Shutdown should separately notify such long-lived connections of shutdown and wait for them to close, if desired.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have this simple program to serve files in the root folder. It always terminates immediately whenever I press Ctrl+C key and the file download process will be failed right away. I tried it in Windows 7 and Ubuntu 16.04.
https://play.golang.org/p/Akv3se9kkZ
--
go install and run the program, get the same result.
--