Gets rid of named return parameters.

This wasn't wrong before but we don't generally use this style in
Consul.
This commit is contained in:
James Phillips 2018-01-25 14:29:50 -08:00
parent b443bd1438
commit 64acd0ade0
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11

View File

@ -52,20 +52,20 @@ func NewGrpcHealthProbe(target string, timeout time.Duration, tlsConfig *tls.Con
// Check if the target of this GrpcHealthProbe is healthy // Check if the target of this GrpcHealthProbe is healthy
// If nil is returned, target is healthy, otherwise target is not healthy // If nil is returned, target is healthy, otherwise target is not healthy
func (probe *GrpcHealthProbe) Check() (err error) { func (probe *GrpcHealthProbe) Check() error {
ctx, cancel := context.WithTimeout(context.Background(), probe.timeout) ctx, cancel := context.WithTimeout(context.Background(), probe.timeout)
defer cancel() defer cancel()
connection, err := grpc.DialContext(ctx, probe.server, probe.dialOptions...) connection, err := grpc.DialContext(ctx, probe.server, probe.dialOptions...)
if err != nil { if err != nil {
return return err
} }
defer connection.Close() defer connection.Close()
client := hv1.NewHealthClient(connection) client := hv1.NewHealthClient(connection)
response, err := client.Check(ctx, probe.request) response, err := client.Check(ctx, probe.request)
if err != nil { if err != nil {
return return err
} }
if response == nil || (response != nil && response.Status != hv1.HealthCheckResponse_SERVING) { if response == nil || (response != nil && response.Status != hv1.HealthCheckResponse_SERVING) {
return ErrGRPCUnhealthy return ErrGRPCUnhealthy