From cba80289870d69aab01fa5437ba5e16fd5c5030c Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 30 Apr 2019 08:29:41 +0800 Subject: [PATCH] fix template lint (#57) * fix template lint * add godoc reference --- README.md | 1 + tool/kratos/template.go | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23add78dd..a0cef9a4b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ![kratos](doc/img/kratos3.png) [![Language](https://img.shields.io/badge/Language-Go-blue.svg)](https://golang.org/) +[![GoDoc](https://godoc.org/github.com/bilibili/kratos?status.svg)](https://godoc.org/github.com/bilibili/kratos) Kratos是[bilibili](https://www.bilibili.com)开源的一套Go微服务框架,包含大量微服务相关框架及工具: diff --git a/tool/kratos/template.go b/tool/kratos/template.go index 679bbd64a..920d604cb 100644 --- a/tool/kratos/template.go +++ b/tool/kratos/template.go @@ -98,11 +98,15 @@ func main() { switch s { case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT: ctx, cancel := context.WithTimeout(context.Background(), 35*time.Second) - defer cancel() - grpcSrv.Shutdown(ctx) - httpSrv.Shutdown(ctx) + if err := grpcSrv.Shutdown(ctx); err != nil + log.Error("grpcSrv.Shutdown error(%v)", err) + } // grpc + if err := httpSrv.Shutdown(ctx); err != nil { + log.Error("httpSrv.Shutdown error(%v)", err) + } log.Info("{{.Name}} exit") svc.Close() + cancel() time.Sleep(time.Second) return case syscall.SIGHUP: