cannot use function (type func()) as type in argument

前端 未结 1 422
陌清茗
陌清茗 2020-12-07 06:28
package main

import (
    \"log\"
    \"strings\"

    \"asl.com/asl\"
)

/*
Trivial service to demonstrate chaining service together
Message starts in originator,          


        
相关标签:
1条回答
  • 2020-12-07 07:12

    You are passing the function as an argument correctly but they do not match the expected signature. Change your functions to:

    func UpperCaseHandler(md busboy.MessageDelivery) (interface{}, error} {
         s.Reply(MessageTest{strings.ToUpper(md.Message.(string))}, md.Delivery)
         return nil, nil
    }
    
    func RepeatHandler(md busboy.MessageDelivery) (interface{}, error} {
         s.Reply(MessageTest{strings.Repeat(md.Message.(string), 5)}, md.Delivery)
         return nil, nil
    }
    
    0 讨论(0)
提交回复
热议问题