第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

大猩猩 jsonrpc 得到空響應

大猩猩 jsonrpc 得到空響應

Go
一只萌萌小番薯 2021-11-01 16:46:34
為什么我的 jsonrpc 方法返回空響應?type Args struct {  A, B int}type Response struct {  sum int  message string}type Arith intfunc (t *Arith) Add(r *http.Request, args *Args, reply *Response) error {  reply.sum = args.A + args.B  reply.message = "Do math"  // this does not work either  //*reply = Response{  //  sum : 12,  //  message : "Do math",  //}  return nil}要求:{"method":"Arith.Add","params":[{"A": 10, "B":2}], "id": 1}回復:{  "result": {},  "error": null,  "id": 1}但是,如果我將類型設置reply為*string,那么這將正常工作:*reply = "Responding with strings works"回復:{  "result": "Responding with strings works",  "error": null,  "id": 1}我正在使用http://www.gorillatoolkit.org/pkg/rpc。
查看完整描述

1 回答

?
收到一只叮咚

TA貢獻1821條經(jīng)驗 獲得超5個贊

您的Response字段未導出。名稱應為大寫:


type Response struct {

    Sum     int

    Message string

}


查看完整回答
反對 回復 2021-11-01
  • 1 回答
  • 0 關(guān)注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號