Skip to content

Commit d46a63d

Browse files
authored
Merge pull request vmkteam#21 from sas1024/master
Fix Golang client response parsing
2 parents 5d23674 + 83763bb commit d46a63d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

golang/go_template.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,20 @@ func (rc *rpcClient) Exec(ctx context.Context, rpcReq zenrpc.Request) (*zenrpc.R
195195
return nil, fmt.Errorf("bad response (%d)", resp.StatusCode)
196196
}
197197
198-
var zresp *zenrpc.Response
198+
var zresp zenrpc.Response
199199
if rpcReq.ID == nil {
200-
return zresp, nil
200+
return &zresp, nil
201201
}
202202
203203
bb, err := io.ReadAll(resp.Body)
204204
if err != nil {
205205
return nil, fmt.Errorf("response body (%s) read failed: %w", bb, err)
206206
}
207207
208-
if err = json.Unmarshal(bb, zresp); err != nil {
208+
if err = json.Unmarshal(bb, &zresp); err != nil {
209209
return nil, fmt.Errorf("json decode failed (%s): %w", bb, err)
210210
}
211211
212-
return zresp, nil
212+
return &zresp, nil
213213
}
214214
`

golang/testdata/catalogue_client.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)