Skip to content

Commit

Permalink
Fix Golang client response parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sas1024 committed Nov 18, 2022
1 parent 5d23674 commit 83763bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions golang/go_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,20 @@ func (rc *rpcClient) Exec(ctx context.Context, rpcReq zenrpc.Request) (*zenrpc.R
return nil, fmt.Errorf("bad response (%d)", resp.StatusCode)
}
var zresp *zenrpc.Response
var zresp zenrpc.Response
if rpcReq.ID == nil {
return zresp, nil
return &zresp, nil
}
bb, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("response body (%s) read failed: %w", bb, err)
}
if err = json.Unmarshal(bb, zresp); err != nil {
if err = json.Unmarshal(bb, &zresp); err != nil {
return nil, fmt.Errorf("json decode failed (%s): %w", bb, err)
}
return zresp, nil
return &zresp, nil
}
`
8 changes: 4 additions & 4 deletions golang/testdata/catalogue_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 83763bb

Please sign in to comment.