1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-03-17 20:28:06 +02:00
2021-01-20 21:28:48 +00:00

32 lines
537 B
Go

package main
import (
"context"
"fmt"
hello "github.com/asim/go-micro/examples/v3/greeter/srv/proto/hello"
"github.com/asim/go-micro/v3"
)
func main() {
// create a new service
service := micro.NewService()
// parse command line flags
service.Init()
// Use the generated client stub
cl := hello.NewSayService("go.micro.srv.greeter", service.Client())
// Make request
rsp, err := cl.Hello(context.Background(), &hello.Request{
Name: "John",
})
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp.Msg)
}