Skip to content

Commit

Permalink
fix golang linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
cageyv committed Nov 7, 2024
1 parent 64b629d commit 36ae71a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions grpc_healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func grpchealthprobe(flAddr string) (string, int) {

opts := []grpc.DialOption{
grpc.WithUserAgent(flUserAgent),
grpc.WithBlock(),
grpc.WithTimeout(flConnTimeout), // Add connection timeout

Check failure on line 53 in grpc_healthcheck.go

View workflow job for this annotation

GitHub Actions / Build

SA1019: grpc.WithTimeout is deprecated: this DialOption is not supported by NewClient. Will be supported throughout 1.x. (staticcheck)
}
if flTLS && flSPIFFE {
log.Printf("-tls and -spiffe are mutually incompatible")
Expand Down Expand Up @@ -98,9 +98,7 @@ func grpchealthprobe(flAddr string) (string, int) {
log.Print("establishing connection")
}
connStart := time.Now()
dialCtx, dialCancel := context.WithTimeout(ctx, flConnTimeout)
defer dialCancel()
conn, err := grpc.DialContext(dialCtx, flAddr, opts...)
conn, err := grpc.Dial(flAddr, opts...)

Check failure on line 101 in grpc_healthcheck.go

View workflow job for this annotation

GitHub Actions / Build

SA1019: grpc.Dial is deprecated: use NewClient instead. Will be supported throughout 1.x. (staticcheck)
if err != nil {
if err == context.DeadlineExceeded {
log.Printf("timeout: failed to connect service %q within %v", flAddr, flConnTimeout)
Expand Down

0 comments on commit 36ae71a

Please sign in to comment.