From e3fcdbf04059d9b2d649de95470bf55d4d24265c Mon Sep 17 00:00:00 2001 From: HarryWang29 Date: Fri, 8 Jan 2021 22:47:27 +0800 Subject: [PATCH] fix return in for (#367) Co-authored-by: HarryWang29 --- tools/goctl/api/gogen/genmiddleware.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/goctl/api/gogen/genmiddleware.go b/tools/goctl/api/gogen/genmiddleware.go index 6bdc0e1b..d4847d62 100644 --- a/tools/goctl/api/gogen/genmiddleware.go +++ b/tools/goctl/api/gogen/genmiddleware.go @@ -48,7 +48,7 @@ func genMiddleware(dir string, cfg *config.Config, api *spec.ApiSpec) error { return err } if !created { - return nil + continue } defer fp.Close() @@ -64,7 +64,9 @@ func genMiddleware(dir string, cfg *config.Config, api *spec.ApiSpec) error { formatCode := formatCode(buffer.String()) _, err = fp.WriteString(formatCode) - return err + if err != nil { + return err + } } return nil }