diff --git a/pkg/proxy/endpointslicecache.go b/pkg/proxy/endpointslicecache.go index 07dc637757b..d1fdeb963ab 100644 --- a/pkg/proxy/endpointslicecache.go +++ b/pkg/proxy/endpointslicecache.go @@ -117,7 +117,7 @@ func newEndpointSliceInfo(endpointSlice *discovery.EndpointSlice, remove bool) * if !remove { for _, endpoint := range endpointSlice.Endpoints { - if endpoint.Conditions.Ready == nil || *endpoint.Conditions.Ready == true { + if endpoint.Conditions.Ready == nil || *endpoint.Conditions.Ready { esInfo.Endpoints = append(esInfo.Endpoints, &endpointInfo{ Addresses: endpoint.Addresses, Topology: endpoint.Topology, diff --git a/pkg/proxy/iptables/proxier_test.go b/pkg/proxy/iptables/proxier_test.go index af5e40d5981..e230f371187 100644 --- a/pkg/proxy/iptables/proxier_test.go +++ b/pkg/proxy/iptables/proxier_test.go @@ -296,10 +296,7 @@ func TestDeleteEndpointConnections(t *testing.T) { if tc.protocol == UDP { isIPv6 := func(ip string) bool { netIP := net.ParseIP(ip) - if netIP.To4() == nil { - return true - } - return false + return netIP.To4() == nil } endpointIP := utilproxy.IPPart(tc.endpoint) expectCommand := fmt.Sprintf("conntrack -D --orig-dst %s --dst-nat %s -p udp", tc.svcIP, endpointIP) diff --git a/pkg/proxy/service.go b/pkg/proxy/service.go index 46cdfa0e910..707947634c5 100644 --- a/pkg/proxy/service.go +++ b/pkg/proxy/service.go @@ -325,7 +325,6 @@ func (sm *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP set // clear changes after applying them to ServiceMap. changes.items = make(map[types.NamespacedName]*serviceChange) metrics.ServiceChangesPending.Set(0) - return } // merge adds other ServiceMap's elements to current ServiceMap. diff --git a/pkg/proxy/winuserspace/proxier.go b/pkg/proxy/winuserspace/proxier.go index e39b24f873b..3e2dbd4036f 100644 --- a/pkg/proxy/winuserspace/proxier.go +++ b/pkg/proxy/winuserspace/proxier.go @@ -189,7 +189,7 @@ func (proxier *Proxier) cleanupStaleStickySessions() { }, Port: name.Port, } - if servicePortNameMap[servicePortName] == false { + if !servicePortNameMap[servicePortName] { // ensure cleanup sticky sessions only gets called once per serviceportname servicePortNameMap[servicePortName] = true proxier.loadBalancer.CleanupStaleStickySessions(servicePortName) diff --git a/pkg/proxy/winuserspace/proxysocket.go b/pkg/proxy/winuserspace/proxysocket.go index 1ac1c76635f..84185042cf6 100644 --- a/pkg/proxy/winuserspace/proxysocket.go +++ b/pkg/proxy/winuserspace/proxysocket.go @@ -27,7 +27,7 @@ import ( "time" "github.com/miekg/dns" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/klog" @@ -426,7 +426,7 @@ func processDNSQueryPacket( } // Query - Response bit that specifies whether this message is a query (0) or a response (1). - if msg.MsgHdr.Response == true { + if msg.MsgHdr.Response { return length, fmt.Errorf("DNS packet should be a query message") } @@ -473,7 +473,7 @@ func processDNSResponsePacket( } // Query - Response bit that specifies whether this message is a query (0) or a response (1). - if msg.MsgHdr.Response == false { + if !msg.MsgHdr.Response { return drop, length, fmt.Errorf("DNS packet should be a response message") }