add goa examples
This commit is contained in:
19
go/goa_example/cmd/host-cli/grpc.go
Normal file
19
go/goa_example/cmd/host-cli/grpc.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
cli "goa_example/gen/grpc/cli/host"
|
||||
"os"
|
||||
|
||||
goa "goa.design/goa/v3/pkg"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
func doGRPC(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) {
|
||||
conn, err := grpc.Dial(host, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not connect to gRPC server at %s: %v\n", host, err)
|
||||
}
|
||||
return cli.ParseEndpoint(conn)
|
||||
}
|
||||
Reference in New Issue
Block a user