文件名称:graceful:使用Server.Shutdown正常关闭Go 1.8+服务器
文件大小:7KB
文件格式:ZIP
更新时间:2024-05-24 19:13:27
go package shutdown graceful Go
优美 安装 go get -u github.com/TV4/graceful 用法 package main import ( "log" "net/http" "time" "github.com/TV4/graceful" ) type server struct {} func ( s * server ) ServeHTTP ( w http. ResponseWriter , r * http. Request ) { time . Sleep ( 2 * time . Second ) w . Write ([] byte ( "Hello!" )) } func main () { addr := ":2017" log . Printf ( "Listening on http://0.0.0.0%s \n " , addr ) graceful . L
【文件预览】:
graceful-master
----go.mod(40B)
----.travis.yml(75B)
----graceful.go(5KB)
----LICENSE(1KB)
----testdata()
--------server.key(306B)
--------server.crt(774B)
----README.md(4KB)
----graceful_test.go(2KB)