fixed unnamed return values

This commit is contained in:
franklin 2016-12-13 17:03:56 +01:00
parent d244d82c85
commit 68dc67cac1
2 changed files with 8 additions and 9 deletions

View File

@ -22,7 +22,7 @@ func CallClient(url string, endpoint string, method string, args []interface{},
// Create request
request := "[" + strings.Join(jsonArgs, ",") + "]"
// Create post url
postURL := fmt.Sprintf("%s%s%s", url, endpoint, method)
postURL := fmt.Sprintf("%s%s/%s", url, endpoint, method)
// Post
resp, err := http.Post(postURL, "application/json", strings.NewReader(request))
if err != nil {

15
go.go
View File

@ -3,8 +3,6 @@ package gotsrpc
import (
"fmt"
"strings"
"github.com/davecgh/go-spew/spew"
)
func (v *Value) isHTTPResponseWriter() bool {
@ -164,9 +162,6 @@ func renderServiceProxies(services map[string]*Service, fullPackageName string,
imports += alias + " \"" + packageName + "\"\n"
}
spew.Dump(aliases)
spew.Dump(fullPackageName)
g.l(`
// this file was auto generated by gotsrpc https://github.com/foomo/gotsrpc
package ` + packageName + `
@ -342,9 +337,13 @@ func renderServiceProxies(services map[string]*Service, fullPackageName string,
}
rets := []string{}
returns := []string{}
for _, r := range method.Return {
rets = append(rets, "&"+r.Name)
returns = append(returns, r.Name+" "+r.Value.goType(aliases, fullPackageName))
for i, r := range method.Return {
name := r.Name
if len(name) == 0 {
name = fmt.Sprintf("ret%s_%d", method.Name, i)
}
rets = append(rets, "&"+name)
returns = append(returns, name+" "+r.Value.goType(aliases, fullPackageName))
}
returns = append(returns, "err error")
g.l(`func (c *` + clientName + `) ` + method.Name + `(` + strings.Join(params, ", ") + `) (` + strings.Join(returns, ", ") + `) {`)