cmd/autogazelle/client_unix.go
func runClient() error {
	startTime := time.Now()
	conn, err := net.Dial("unix", *socketPath)
	if err != nil {
		if err := startServer(); err != nil {
			return fmt.Errorf("error starting server: %v", err)
		}
		for retry := 0; retry < 3; retry++ {
			conn, err = net.Dial("unix", *socketPath)
			if err == nil {
				break
			}
			// Wait for server to start listening.
			time.Sleep(1 * time.Second)
		}
		if err != nil {
			return fmt.Errorf("failed to connect to server: %v", err)
		}
	}
	defer conn.Close()

	if _, err := io.Copy(os.Stderr, conn); err != nil {
		log.Print(err)
	}

	elapsedTime := time.Since(startTime)
	log.Printf("ran gazelle in %.3f s", elapsedTime.Seconds())
	return nil
}
func runClient() error {
	startTime := time.Now()
	conn, err := net.Dial("unix", *socketPath)
	if err != nil {
		if err := startServer(); err != nil {
			return fmt.Errorf("error starting server: %v", err)
		}
		for retry := 0; retry < 3; retry++ {
			conn, err = net.Dial("unix", *socketPath)
			if err == nil {
				break
			}
			// Wait for server to start listening.
			time.Sleep(1 * time.Second)
		}
		if err != nil {
			return fmt.Errorf("failed to connect to server: %v", err)
		}
	}
	defer conn.Close()

	if _, err := io.Copy(os.Stderr, conn); err != nil {
		log.Print(err)
	}

	elapsedTime := time.Since(startTime)
	log.Printf("ran gazelle in %.3f s", elapsedTime.Seconds())
	return nil
}
// runClient performs the main work of the client. It attempts to connect
// to the server via a UNIX-domain socket. If the server is not running,
// it starts the server and tries again. The server does all the work, so
// the client just waits for the server to complete, then exits.