From 5b3768235a1d274a605276e248d966faec623cd6 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Tue, 25 Jan 2022 00:38:04 +0100 Subject: [PATCH] Let helloworld example listen to all hosts (#5089) This commit changes the address that the helloworld greeter_server is listening to from "localhost:" to just ":", thus enabling the server to be used in setups where the request stem from another host. Signed-off-by: Thomas Hallgren --- examples/helloworld/greeter_server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/helloworld/greeter_server/main.go b/examples/helloworld/greeter_server/main.go index 728bb19fd..7a62a9b9f 100644 --- a/examples/helloworld/greeter_server/main.go +++ b/examples/helloworld/greeter_server/main.go @@ -47,7 +47,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe func main() { flag.Parse() - lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", *port)) + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) if err != nil { log.Fatalf("failed to listen: %v", err) }