I am not sure what you were expecting as a result of your example, but it appears to work for me in Ubuntu:
$ go run test.go 2017/03/11 03:03:13 Server started at localhost:8080 ^C2017/03/11 03:03:19 Shutting down server... 2017/03/11 03:03:19 Server gracefully stopped On Fri, Mar 10, 2017 at 10:58 AM Andrew <angang....@gmail.com> wrote: > 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 > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.