Skip to content

Commit

Permalink
pkg/daemon: use grpc.NewClient instead of Dial
Browse files Browse the repository at this point in the history
Dial and DialContext is deprecated in newer version of gRPC.
(See https://pkg.go.dev/google.golang.org/grpc#Dial)
  • Loading branch information
lukedirtwalker committed Dec 3, 2024
1 parent dd852aa commit 308162e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/daemon/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/timestamppb"

Expand Down Expand Up @@ -48,15 +49,14 @@ type Service struct {
}

func (s Service) Connect(ctx context.Context) (Connector, error) {
a, err := net.ResolveTCPAddr("tcp", s.Address)
conn, err := grpc.NewClient(s.Address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
libgrpc.UnaryClientInterceptor(),
libgrpc.StreamClientInterceptor(),
)
if err != nil {
s.Metrics.incConnects(err)
return nil, serrors.Wrap("resolving addr", err)
}
conn, err := libgrpc.SimpleDialer{}.Dial(ctx, a)
if err != nil {
s.Metrics.incConnects(err)
return nil, serrors.Wrap("dialing", err)
return nil, serrors.Wrap("creating client", err)
}
s.Metrics.incConnects(nil)
return grpcConn{conn: conn, metrics: s.Metrics}, nil
Expand Down

0 comments on commit 308162e

Please sign in to comment.