Skip to content

Commit

Permalink
pkg: Use new grpc.NewClient over grpc.Dial (#4676)
Browse files Browse the repository at this point in the history
* pkg: Use newer grpc.NewClient over deprecated grpc.Dial

* Update deprecated golanglint-ci config
  • Loading branch information
metalmatze authored May 27, 2024
1 parent bddec44 commit 7ff555c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .errcheck_excludes.txt

This file was deleted.

4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ linters-settings:
- pkg: github.com/segmentio/parquet-go
desc: Use github.com/parquet-go/parquet-go instead
errcheck:
exclude: ./.errcheck_excludes.txt
exclude-functions:
- (github.com/go-kit/log.Logger).Log
- (hash.Hash).Write
goimports:
local-prefixes: github.com/parca-dev/parca
gofumpt:
Expand Down
2 changes: 1 addition & 1 deletion pkg/debuginfo/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestStore(t *testing.T) {
}
}()

conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down
4 changes: 2 additions & 2 deletions pkg/parca/parca.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func Run(ctx context.Context, logger log.Logger, reg *prometheus.Registry, flags
otelgrpc.WithPropagators(propagators),
)),
}
conn, err := grpc.Dial(flags.ProfileShareServer, opts...)
conn, err := grpc.NewClient(flags.ProfileShareServer, opts...)
if err != nil {
return fmt.Errorf("failed to create gRPC connection to ProfileShareServer: %s, %w", flags.ProfileShareServer, err)
}
Expand Down Expand Up @@ -720,7 +720,7 @@ func runForwarder(
}))
}

conn, err := grpc.Dial(flags.StoreAddress, opts...)
conn, err := grpc.NewClient(flags.StoreAddress, opts...)
if err != nil {
return fmt.Errorf("failed to create gRPC connection: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/parca/parca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import (
)

func getShareServerConn(t Testing) sharepb.ShareServiceClient {
conn, err := grpc.Dial("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
conn, err := grpc.NewClient("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
require.NoError(t, err)
return sharepb.NewShareServiceClient(conn)
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func benchmarkSetup(ctx context.Context, b *testing.B) (profilestorepb.ProfileSt
var conn grpc.ClientConnInterface
err := backoff.Retry(func() error {
var err error
conn, err = grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
// b.Logf("failed to connect to parca: %v", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/columnquery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
)

func getShareServerConn(t Testing) sharepb.ShareServiceClient {
conn, err := grpc.Dial("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
conn, err := grpc.NewClient("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
require.NoError(t, err)
return sharepb.NewShareServiceClient(conn)
}
Expand Down

0 comments on commit 7ff555c

Please sign in to comment.