1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-05 10:20:53 +02:00
go-micro/examples/secure/cli/main.go
2021-01-20 21:28:48 +00:00

35 lines
559 B
Go

package main
import (
"fmt"
"github.com/asim/go-micro/v3/client"
"github.com/asim/go-micro/v3/transport"
hello "github.com/asim/go-micro/examples/v3/greeter/srv/proto/hello"
"context"
)
func init() {
client.DefaultClient.Init(
client.Transport(
transport.NewHTTPTransport(transport.Secure(true)),
),
)
}
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)
}