imp error cli

master
Paulo Simão 2020-12-15 15:27:08 -03:00
parent 56344e64e5
commit 943bd7e769
1 changed files with 5 additions and 1 deletions

View File

@ -92,7 +92,11 @@ func invoke(m string, path string, bodyo interface{}) (*json.Decoder, error) {
for k, m := range api.Methods { 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("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{} ret := %s{}
err = dec.Decode(%sret) err = dec.Decode(%sret)
if err != nil{ if err != nil{