Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
helloworld
✓ google.golang.org/grpc/examples/helloworld
Connects to a gRPC server and calls the SayHello RPC.
package main
import (
"context"
"log"
"time"
pb "google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc"
)
func main() {
conn, err := grpc.Dial("localhost:50051", grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}
defer conn.Close()
c := pb.NewGreeterClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
r, err := c.SayHello(ctx, &pb.HelloRequest{Name: "World"})
if err != nil {
log.Fatal(err)
}
log.Printf("Greeting: %s", r.Message)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Dependencies
No dependency data recorded yet.