Skip to content

Commit

Permalink
Satisfy linters
Browse files Browse the repository at this point in the history
  • Loading branch information
monstermunchkin committed Sep 20, 2024
1 parent cbb090f commit 61a1a70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ import (
grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
)

func DialContext(ctx context.Context, addr string) (*grpc.ClientConn, error) {
return dialCtx(ctx, addr)
// Deprecated: Use NewClient instead.
func DialContext(_ context.Context, addr string) (*grpc.ClientConn, error) {
return NewClient(addr)
}

// Deprecated: Use NewClient instead.
func Dial(addr string) (*grpc.ClientConn, error) {
return dialCtx(context.Background(), addr)
return NewClient(addr)
}

func dialCtx(ctx context.Context, addr string) (*grpc.ClientConn, error) {
func NewClient(addr string) (*grpc.ClientConn, error) {
var conn *grpc.ClientConn

clientMetrics := grpc_prometheus.NewClientMetrics()

opts := []grpc_retry.CallOption{
grpc_retry.WithBackoff(grpc_retry.BackoffLinear(100 * time.Millisecond)),
}
conn, err := grpc.DialContext(ctx, addr, grpc.WithTransportCredentials(insecure.NewCredentials()),

conn, err := grpc.NewClient(addr,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithChainStreamInterceptor(
grpc_opentracing.StreamClientInterceptor(),
grpc_opentracing.StreamClientInterceptor(),
Expand Down
2 changes: 1 addition & 1 deletion http/jsonapi/generator/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestGenerator(t *testing.T) {
Context: 3,
}
text, _ := difflib.GetUnifiedDiffString(diff)
t.Errorf(text)
t.Error(text)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion tools/testserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func main() {
h.HandleFunc("/grpc", func(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()

conn, err := grpc.DialContext(ctx, ":3001")
conn, err := grpc.NewClient(":3001")
if err != nil {
log.Fatalf("did not connect: %s", err)
}
Expand Down

0 comments on commit 61a1a70

Please sign in to comment.