douhua1890 2015-04-08 16:44
浏览 27

大猩猩xmlrpc的小写方法

I'm using Gorilla XMLRPC. As per the example,

func (h *HelloService) Say(r     *http.Request, 
                           args  *struct{Who string}, 
                           reply *struct{Message string}) error {
    reply.Message = "Hello, " + args.Who + "!"
    return nil
}

and RPC.RegisterService(new(HelloService), "") gives me a service HelloService.Say(). I would like to have helloService.say(). I was able to get the first part by modifying the register function to RPC.RegisterService(new(HelloService), "helloService"). But I'm not able to make lowercase methods exported.

I understand golang allows only uppercase methods to be exported. So is there any work-around for lowercase methods?

  • 写回答

2条回答 默认 最新

  • douangoo48863 2015-04-09 02:40
    关注

    I think the first question is "why does it need to be [lowercase] "say" and the second question would need to be, if it needed to be that way, why use Go?

    It's a convention that Uppercase methods and properties are exported and lowercase methods and properties are private.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序