Skip to content

Commit

Permalink
Removed deprecated functions usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed May 15, 2024
1 parent 6f8bd07 commit be1085c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion commands/term_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`")
}
Expand Down
6 changes: 1 addition & 5 deletions docs/integration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`")
Expand Down
2 changes: 1 addition & 1 deletion internal/integrationtest/arduino-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rpc/internal/client_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`")
}
Expand Down
7 changes: 1 addition & 6 deletions rpc/internal/get_version_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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`")
Expand Down

0 comments on commit be1085c

Please sign in to comment.