Skip to content

Commit be1085c

Browse files
committed
Removed deprecated functions usage
1 parent 6f8bd07 commit be1085c

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

commands/term_example/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// This program exercise CLI monitor functionality.
3232

3333
func main() {
34-
conn, err := grpc.Dial("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
34+
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
3535
if err != nil {
3636
log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")
3737
}

docs/integration-options.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ import (
175175

176176
func main() {
177177
// Establish a connection with the gRPC server
178-
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
179-
conn, err := grpc.DialContext(ctx, "localhost:50051",
180-
grpc.WithTransportCredentials(insecure.NewCredentials()),
181-
grpc.WithBlock())
182-
cancel()
178+
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
183179
if err != nil {
184180
log.Println(err)
185181
log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")

internal/integrationtest/arduino-cli.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (cli *ArduinoCLI) StartDaemon(verbose bool) string {
408408
}
409409
go _copy(os.Stdout, stdout)
410410
go _copy(os.Stderr, stderr)
411-
conn, err := grpc.Dial(cli.daemonAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
411+
conn, err := grpc.NewClient(cli.daemonAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
412412
cli.t.NoError(err)
413413
cli.daemonConn = conn
414414
cli.daemonClient = commands.NewArduinoCoreServiceClient(conn)

rpc/internal/client_example/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func main() {
4343

4444
// Establish a connection with the gRPC server, started with the command:
4545
// arduino-cli daemon
46-
conn, err := grpc.Dial("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
46+
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
4747
if err != nil {
4848
log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")
4949
}

rpc/internal/get_version_example/main.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package main
1818
import (
1919
"context"
2020
"log"
21-
"time"
2221

2322
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2423
"google.golang.org/grpc"
@@ -27,11 +26,7 @@ import (
2726

2827
func main() {
2928
// Establish a connection with the gRPC server
30-
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
31-
conn, err := grpc.DialContext(ctx, "localhost:50051",
32-
grpc.WithTransportCredentials(insecure.NewCredentials()),
33-
grpc.WithBlock())
34-
cancel()
29+
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
3530
if err != nil {
3631
log.Println(err)
3732
log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")

0 commit comments

Comments
 (0)