Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change client dialOpts append order #11322

Merged
merged 9 commits into from
Mar 24, 2022
4 changes: 3 additions & 1 deletion api/client/client.go
Original file line number Diff line number Diff line change
@@ -358,7 +358,7 @@ func (c *Client) dialGRPC(ctx context.Context, addr string) error {
dialContext, cancel := context.WithTimeout(ctx, c.c.DialTimeout)
defer cancel()

dialOpts := append([]grpc.DialOption{}, c.c.DialOpts...)
var dialOpts []grpc.DialOption
dialOpts = append(dialOpts, grpc.WithContextDialer(c.grpcDialer()))
dialOpts = append(dialOpts,
grpc.WithUnaryInterceptor(metadata.UnaryClientInterceptor),
@@ -368,6 +368,8 @@ func (c *Client) dialGRPC(ctx context.Context, addr string) error {
if c.tlsConfig != nil {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsConfig)))
}
// must come last, otherwise provided opts may get clobbered by defaults above
dialOpts = append(dialOpts, c.c.DialOpts...)

var err error
if c.conn, err = grpc.DialContext(dialContext, addr, dialOpts...); err != nil {