Merge pull request #84440 from lsytj0413/fix-gosimple

refactor(*): fix comparison to bool constant, return redundant
This commit is contained in:
Kubernetes Prow Robot 2019-11-01 18:08:10 -07:00 committed by GitHub
commit 1da7210180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 10 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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.

View File

@ -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)

View File

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