From 693a8b627ac54e72ee8c654495f64cc9d3e6cd4c Mon Sep 17 00:00:00 2001 From: stevenzack Date: Sun, 16 Aug 2020 21:00:45 +0800 Subject: [PATCH] fix-log-fatal --- tools/goctl/api/ktgen/gen.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/goctl/api/ktgen/gen.go b/tools/goctl/api/ktgen/gen.go index c3c53815..f390c7e6 100644 --- a/tools/goctl/api/ktgen/gen.go +++ b/tools/goctl/api/ktgen/gen.go @@ -2,7 +2,6 @@ package ktgen import ( "fmt" - "log" "os" "path/filepath" "text/template" @@ -136,12 +135,8 @@ func genApi(dir, pkg string, api *spec.ApiSpec) error { defer file.Close() t, e := template.New("api").Funcs(funcsMap).Parse(apiTemplate) - if e != nil { - log.Fatal(e) - } - e = t.Execute(file, api) - if e != nil { - log.Fatal(e) + if e!=nil { + return e } - return nil + return t.Execute(file, api) }