mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-07-20 23:22:53 +02:00
initial import
This commit is contained in:
22
microservices/grpc/client/cmd/main.go
Normal file
22
microservices/grpc/client/cmd/main.go
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"golang.source-fellows.com/samples/grpc/hello"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
con, _ := grpc.Dial(":8080", grpc.WithInsecure())
|
||||
client := hello.NewHelloWorldServiceClient(con)
|
||||
|
||||
ctx := context.Background()
|
||||
answer, err := client.SayHello(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(answer.GetMessageText())
|
||||
}
|
Reference in New Issue
Block a user