package main import ( "context" "fmt" "git.nspix.com/golang/micro" ) type ( Math struct{} mathRequest struct { NumA int `json:"num_a"` NumB int `json:"num_b"` } mathResponse struct { Value int `json:"value"` } ) func main() { s := micro.New( micro.WithName("aa", "1.0.1"), ) req, err := s.CreateRequest("test", "math.add", &mathRequest{ NumA: 100, NumB: 221, }) if err != nil { fmt.Println(err) return } if res, err := req.Do(context.Background()); err != nil { fmt.Println(err) } else { if res.Error() != nil { fmt.Println(err) } else { rr := &mathResponse{} res.Decode(rr) fmt.Println(rr) } } fmt.Println(s.Run()) }