Skip to content

Commit

Permalink
fix ineffectual assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
sandyskies committed Nov 27, 2018
1 parent 1f986f8 commit 0c9aa19
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions examples/ContextTestServer/ContextTestImp.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func (imp *ContextTestImp) Add(ctx context.Context, a int32, b int32, c *int32)
k := make(map[string]string)
k["resp"] = "respform context"
ok = current.SetResponseContext(ctx, k)
if !ok {
logger.Error("error setting respose context")
}
//Doing something in your function
//...
*c = a * b
Expand Down
3 changes: 3 additions & 0 deletions tars/protocol/codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ func (b *Reader) skipField(ty byte) error {
if tyCur != BYTE {
return fmt.Errorf("simple list need byte head. but get %d", tyCur)
}
if err != nil {
return err
}
var len int32
err = b.Read_int32(&len, 0, true)
if err != nil {
Expand Down
17 changes: 12 additions & 5 deletions tars/tools/tars2go/gen_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ func (gen *GenGo) genType(ty *VarType) string {
case tkTMap:
ret = "map[" + gen.genType(ty.TypeK) + "]" + gen.genType(ty.TypeV)
case tkName:
ret = strings.Replace(ty.TypeSt, "::", ".", -1)
//Actrually ret is useless here
//ret = strings.Replace(ty.TypeSt, "::", ".", -1)
vec := strings.Split(ty.TypeSt, "::")
for i := range vec {
if *gAddServant == true {
Expand Down Expand Up @@ -473,12 +474,18 @@ func (gen *GenGo) genReadVector(mb *StructMember, prefix string, hasRet bool) {
if mb.Require {
require = "true"
}
c.WriteString(`
err, have, ty = _is.SkipToNoCheck(` + tag + `,` + require + `)
` + errStr + `
`)

if require == "false" {
c.WriteString(`
err, have, ty = _is.SkipToNoCheck(` + tag + `,` + require + `)
` + errStr + `
`)
c.WriteString("if have {")
} else {
c.WriteString(`
err, _, ty = _is.SkipToNoCheck(` + tag + `,` + require + `)
` + errStr + `
`)
}

c.WriteString(`
Expand Down

0 comments on commit 0c9aa19

Please sign in to comment.