Skip to content

Commit

Permalink
chore: use NewClient instead of Dial (deprecated)
Browse files Browse the repository at this point in the history
grpc pkg introduced NewClient in v1.63.0.

SA1019  grpc.Dial is deprecated: use NewClient instead.  Will be supported throughout 1.x.
  • Loading branch information
geyslan committed Jun 7, 2024
1 parent a9aacbf commit 435b593
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/containers/runtime/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func ContainerdEnricher(socket string) (ContainerEnricher, error) {
return nil, errfmt.WrapError(err)
}

conn, err := grpc.Dial(unixSocket, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(unixSocket, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
if errC := client.Close(); errC != nil {
logger.Errorw("Closing containerd connection", "error", errC)
Expand Down
2 changes: 1 addition & 1 deletion pkg/containers/runtime/crio.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type crioEnricher struct {

func CrioEnricher(socket string) (ContainerEnricher, error) {
unixSocket := "unix://" + strings.TrimPrefix(socket, "unix://")
conn, err := grpc.Dial(unixSocket, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(unixSocket, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, errfmt.WrapError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/grpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestServer(t *testing.T) {

func grpcClient(protocol, addr string) pb.TraceeServiceClient {
sock := protocol + ":" + addr
conn, err := grpc.Dial(sock, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(sock, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-inst-signatures/scripts/ds_writer/ds_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
printAndExit("empty value given\n")
}

conn, err := grpc.Dial(
conn, err := grpc.NewClient(
"unix:///tmp/tracee.sock",
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down

0 comments on commit 435b593

Please sign in to comment.