Updates go lang support to allow other languages to communicate with it (#6653)

This commit is contained in:
mustiikhalil
2021-05-20 21:32:56 +03:00
committed by GitHub
parent 512d5a6897
commit 8937dcfd78
2 changed files with 3 additions and 4 deletions

View File

@@ -7,5 +7,5 @@ replace github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0 =>
require (
github.com/google/flatbuffers v1.12.0
github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0
google.golang.org/grpc v1.35.0
google.golang.org/grpc v1.39.0-dev
)

View File

@@ -9,7 +9,6 @@ import (
flatbuffers "github.com/google/flatbuffers/go"
models "github.com/google/flatbuffers/grpc/examples/go/greeter/models"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding"
)
var (
@@ -68,8 +67,8 @@ func main() {
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
grpcServer := grpc.NewServer()
encoding.RegisterCodec(flatbuffers.FlatbuffersCodec{})
codec := &flatbuffers.FlatbuffersCodec{}
grpcServer := grpc.NewServer(grpc.ForceServerCodec(codec))
models.RegisterGreeterServer(grpcServer, newServer())
if err := grpcServer.Serve(lis); err != nil {
fmt.Print(err)