diff --git a/agent/checks/grpc.go b/agent/checks/grpc.go index 974ba9aa3..8577ae6e7 100644 --- a/agent/checks/grpc.go +++ b/agent/checks/grpc.go @@ -67,7 +67,7 @@ func (probe *GrpcHealthProbe) Check() error { if err != nil { return err } - if response == nil || (response != nil && response.Status != hv1.HealthCheckResponse_SERVING) { + if response == nil || response.Status != hv1.HealthCheckResponse_SERVING { return ErrGRPCUnhealthy } diff --git a/agent/consul/acl_replication_types.go b/agent/consul/acl_replication_types.go index 26ac8dbc4..3009bec98 100644 --- a/agent/consul/acl_replication_types.go +++ b/agent/consul/acl_replication_types.go @@ -90,7 +90,7 @@ func (r *aclTokenReplicator) DeleteLocalBatch(srv *Server, batch []string) error if err != nil { return err } - if respErr, ok := resp.(error); ok && err != nil { + if respErr, ok := resp.(error); ok { return respErr } return nil @@ -119,7 +119,7 @@ func (r *aclTokenReplicator) UpdateLocalBatch(ctx context.Context, srv *Server, if err != nil { return err } - if respErr, ok := resp.(error); ok && err != nil { + if respErr, ok := resp.(error); ok { return respErr } @@ -202,7 +202,7 @@ func (r *aclPolicyReplicator) DeleteLocalBatch(srv *Server, batch []string) erro if err != nil { return err } - if respErr, ok := resp.(error); ok && err != nil { + if respErr, ok := resp.(error); ok { return respErr } return nil diff --git a/agent/xds/clusters.go b/agent/xds/clusters.go index 7202d0497..290f14e3a 100644 --- a/agent/xds/clusters.go +++ b/agent/xds/clusters.go @@ -60,31 +60,29 @@ func (s *Server) makeAppCluster(cfgSnap *proxycfg.ConfigSnapshot) (*envoy.Cluste return makeClusterFromUserConfig(cfg.LocalClusterJSON) } - if c == nil { - addr := cfgSnap.Proxy.LocalServiceAddress - if addr == "" { - addr = "127.0.0.1" - } - c = &envoy.Cluster{ - Name: LocalAppClusterName, - ConnectTimeout: time.Duration(cfg.LocalConnectTimeoutMs) * time.Millisecond, - ClusterDiscoveryType: &envoy.Cluster_Type{Type: envoy.Cluster_STATIC}, - LoadAssignment: &envoy.ClusterLoadAssignment{ - ClusterName: LocalAppClusterName, - Endpoints: []envoyendpoint.LocalityLbEndpoints{ - { - LbEndpoints: []envoyendpoint.LbEndpoint{ - makeEndpoint(LocalAppClusterName, - addr, - cfgSnap.Proxy.LocalServicePort), - }, + addr := cfgSnap.Proxy.LocalServiceAddress + if addr == "" { + addr = "127.0.0.1" + } + c = &envoy.Cluster{ + Name: LocalAppClusterName, + ConnectTimeout: time.Duration(cfg.LocalConnectTimeoutMs) * time.Millisecond, + ClusterDiscoveryType: &envoy.Cluster_Type{Type: envoy.Cluster_STATIC}, + LoadAssignment: &envoy.ClusterLoadAssignment{ + ClusterName: LocalAppClusterName, + Endpoints: []envoyendpoint.LocalityLbEndpoints{ + { + LbEndpoints: []envoyendpoint.LbEndpoint{ + makeEndpoint(LocalAppClusterName, + addr, + cfgSnap.Proxy.LocalServicePort), }, }, }, - } - if cfg.Protocol == "http2" || cfg.Protocol == "grpc" { - c.Http2ProtocolOptions = &envoycore.Http2ProtocolOptions{} - } + }, + } + if cfg.Protocol == "http2" || cfg.Protocol == "grpc" { + c.Http2ProtocolOptions = &envoycore.Http2ProtocolOptions{} } return c, err