diff --git a/commands/term_example/main.go b/commands/term_example/main.go index 4d202ec5bd7..f5f96623617 100644 --- a/commands/term_example/main.go +++ b/commands/term_example/main.go @@ -31,7 +31,7 @@ import ( // This program exercise CLI monitor functionality. func main() { - conn, err := grpc.Dial("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`") } diff --git a/docs/integration-options.md b/docs/integration-options.md index ea4ad1eda9f..fe476365407 100644 --- a/docs/integration-options.md +++ b/docs/integration-options.md @@ -175,11 +175,7 @@ import ( func main() { // Establish a connection with the gRPC server - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - conn, err := grpc.DialContext(ctx, "localhost:50051", - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) - cancel() + conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Println(err) log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`") diff --git a/internal/integrationtest/arduino-cli.go b/internal/integrationtest/arduino-cli.go index 0e795f64d26..c20ac3c106a 100644 --- a/internal/integrationtest/arduino-cli.go +++ b/internal/integrationtest/arduino-cli.go @@ -408,7 +408,7 @@ func (cli *ArduinoCLI) StartDaemon(verbose bool) string { } go _copy(os.Stdout, stdout) go _copy(os.Stderr, stderr) - conn, err := grpc.Dial(cli.daemonAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.NewClient(cli.daemonAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) cli.t.NoError(err) cli.daemonConn = conn cli.daemonClient = commands.NewArduinoCoreServiceClient(conn) diff --git a/rpc/internal/client_example/main.go b/rpc/internal/client_example/main.go index 9fe750f36ea..00f0acaa7f7 100644 --- a/rpc/internal/client_example/main.go +++ b/rpc/internal/client_example/main.go @@ -43,7 +43,7 @@ func main() { // Establish a connection with the gRPC server, started with the command: // arduino-cli daemon - conn, err := grpc.Dial("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`") } diff --git a/rpc/internal/get_version_example/main.go b/rpc/internal/get_version_example/main.go index 9e72414c8b0..0143a14d1e1 100644 --- a/rpc/internal/get_version_example/main.go +++ b/rpc/internal/get_version_example/main.go @@ -18,7 +18,6 @@ package main import ( "context" "log" - "time" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "google.golang.org/grpc" @@ -27,11 +26,7 @@ import ( func main() { // Establish a connection with the gRPC server - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - conn, err := grpc.DialContext(ctx, "localhost:50051", - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) - cancel() + conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Println(err) log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")