2020-12-26 17:17:20 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2021-01-20 15:54:31 +02:00
|
|
|
"github.com/asim/go-micro/v3/client"
|
|
|
|
"github.com/asim/go-micro/v3/transport"
|
2020-12-26 17:17:20 +02:00
|
|
|
|
2021-01-20 23:28:48 +02:00
|
|
|
hello "github.com/asim/go-micro/examples/v3/greeter/srv/proto/hello"
|
2020-12-26 17:17:20 +02:00
|
|
|
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
client.DefaultClient.Init(
|
|
|
|
client.Transport(
|
2021-01-20 23:28:48 +02:00
|
|
|
transport.NewHTTPTransport(transport.Secure(true)),
|
2020-12-26 17:17:20 +02:00
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
cl := hello.NewSayService("go.micro.srv.greeter", client.DefaultClient)
|
|
|
|
|
|
|
|
rsp, err := cl.Hello(context.TODO(), &hello.Request{
|
|
|
|
Name: "John",
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(rsp.Msg)
|
|
|
|
}
|