Skip to content

Instantly share code, notes, and snippets.

  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Golang GRPC Unix Socket
conn, err := grpc.Dial(
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
if err != nil {
log.Fatalf("did not connect: %v", err)
defer conn.Close()
c := pb.NewGreeterClient(conn)
// Contact the server and print out its response.
hostname, _ := os.Hostname()
r, err := c.SayHello(context.Background(), &pb.HelloRequest{Name: hostname + "-worker"})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Printf("Greeting: %s", r.Message)
Copy link

Doesn't it work with unix://addr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment