Understanding the Problem
The error message "cannot use function (type func()) as type in argument" means that the function you are trying to pass does not match the type required by the argument.在这种情况下,该参数期望MessageHandler接口的实现,该界面具有特定的函数签名。的函数必须确保您的函数符合消息HandsHandler接口的预期签名:
示例:修改您的函数以与必需的签名对齐:[&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& uppercaseHandler(MessagedEliveLivery) s.reply(messagetest {strings.toupper(md.message。(string))},md.delivery) 返回零,零 } func repeathandler(MD MessagedElivery)(接口{},错误){ s.reply(messagetest {strings.repeat(md.message。(string),5),5)},md.delivery) 返回零,零 } [&& && && && && &&华
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3