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

refactor(*): fix comparison to bool constant, return redundant #84440

Merged
merged 1 commit into from Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/proxy/endpointslicecache.go
Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions pkg/proxy/iptables/proxier_test.go
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion pkg/proxy/service.go
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/winuserspace/proxier.go
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/winuserspace/proxysocket.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}

Expand Down Expand Up @@ -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")
}

Expand Down