refactor: replace deprecated grpc.Dial with grpc.NewClient in code and docs
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"grpccanary/examples/grpcentity/protoapi"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
@@ -39,9 +38,9 @@ func AskUpdateSensingData(ctx context.Context, m protoapi.IoTServiceClient, devi
|
||||
}
|
||||
|
||||
func ClientRun(addr string) {
|
||||
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
fmt.Println("Dial:", err)
|
||||
fmt.Println("NewClient error:", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,7 +52,6 @@ func ClientRun(addr string) {
|
||||
}
|
||||
fmt.Println("Server Date and Time:", r.Value)
|
||||
|
||||
rand.Seed(time.Now().Unix())
|
||||
length := int64(rand.Intn(20))
|
||||
p, err := AskPass(context.Background(), client, 100, length+1)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user