From 943bd7e7696d83b026c0dde1a2ca0cc28fd48bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Sima=CC=83o?= Date: Tue, 15 Dec 2020 15:27:08 -0300 Subject: [PATCH] imp error cli --- src/processGoClientOutput.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/processGoClientOutput.go b/src/processGoClientOutput.go index 0c8bbb9..3a19f23 100644 --- a/src/processGoClientOutput.go +++ b/src/processGoClientOutput.go @@ -92,7 +92,11 @@ func invoke(m string, path string, bodyo interface{}) (*json.Decoder, error) { for k, m := range api.Methods { b.WriteString(fmt.Sprintf("func %s(req %s) (res %s, err error){\n", k, APIParamTypeDecToString(m.ReqType), APIParamTypeDecToString(m.ResType))) - b.WriteString(fmt.Sprintf(` dec, err := invoke("%s", "%s", req) + b.WriteString(fmt.Sprintf(`var dec *json.Decoder + dec, err = invoke("%s", "%s", req) + if err!=nil{ + return + } ret := %s{} err = dec.Decode(%sret) if err != nil{