1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-03-23 20:32:32 +02:00

32 lines
535 B
Go
Raw Normal View History

2020-12-26 15:17:20 +00:00
package main
import (
"context"
"fmt"
2020-12-26 15:21:29 +00:00
hello "github.com/micro/go-micro/examples/greeter/srv/proto/hello"
"github.com/asim/go-micro/v3"
2020-12-26 15:17:20 +00:00
)
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)
}