fix(#7360): grpc used deprecated functions (#7361)

This commit is contained in:
godcong 2022-07-27 06:10:13 +08:00 committed by GitHub
parent b7f13cd8e8
commit 52fce5e532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,8 +9,10 @@ import (
"time"
flatbuffers "github.com/google/flatbuffers/go"
models "github.com/google/flatbuffers/grpc/examples/go/greeter/models"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
models "github.com/google/flatbuffers/grpc/examples/go/greeter/models"
)
var (
@ -63,7 +65,9 @@ func printSayManyHello(client models.GreeterClient, name string) {
func main() {
flag.Parse()
conn, err := grpc.Dial(fmt.Sprintf("localhost:%d", 3000), grpc.WithInsecure(), grpc.WithCodec(flatbuffers.FlatbuffersCodec{}))
conn, err := grpc.Dial(fmt.Sprintf("localhost:%d", 3000),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(grpc.ForceCodec(flatbuffers.FlatbuffersCodec{})))
if err != nil {
log.Fatalf("fail to dial: %v", err)
}