Skip to content

Commit

Permalink
Optimize the comparison mode of bool judgment
Browse files Browse the repository at this point in the history
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
  • Loading branch information
Fish-pro committed Jan 7, 2023
1 parent 80af06e commit 0552604
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cilium/cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func getIpv6EnableStatus() bool {
if _, err := client.Daemon.GetHealthz(params); err == nil {
if resp, err := client.ConfigGet(); err == nil {
if resp.Status != nil {
return resp.Status.Addressing.IPV6 != nil && resp.Status.Addressing.IPV6.Enabled == true
return resp.Status.Addressing.IPV6 != nil && resp.Status.Addressing.IPV6.Enabled
}
}
} else { // else read the EnableIPv6 status from the file-system
Expand Down
2 changes: 1 addition & 1 deletion pkg/bgp/speaker/speaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func TestSpeakerOnDeleteNode(t *testing.T) {
}

// confirm speaker rejects any further events.
if spkr.shutDown() != true {
if !spkr.shutDown() {
t.Fatalf("wanted speaker to be shutdown")
}
if err := spkr.OnAddNode(nil, nil); !errors.Is(err, ErrShutDown) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/datapath/linux/ipsec/ipsec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func ipSecReplaceStateIn(remoteIP, localIP net.IP, zeroMark bool) (uint8, error)
Value: linux_defaults.RouteMarkDecrypt,
Mask: linux_defaults.IPsecMarkMaskIn,
}
if zeroMark != true {
if !zeroMark {
state.OutputMark = &netlink.XfrmMark{
Value: linux_defaults.RouteMarkDecrypt,
Mask: linux_defaults.RouteMarkMask,
Expand Down
2 changes: 1 addition & 1 deletion pkg/datapath/linux/route/route_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ func replaceRule(spec Rule, family int) error {
if err != nil {
return err
}
if exists == true {
if exists {
return nil
}
rule := netlink.NewRule()
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8s/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ func (s *Service) EqualsClusterService(svc *serviceStore.ClusterService) bool {
// These comparisons must match the ParseClusterService() function above.
if ip.UnsortedIPListsAreEqual(s.FrontendIPs, feIPs) &&
s.IsHeadless == (len(svc.Frontends) == 0) &&
s.IncludeExternal == true &&
s.Shared == true &&
s.IncludeExternal &&
s.Shared &&
s.ExtTrafficPolicy == loadbalancer.SVCTrafficPolicyCluster &&
s.IntTrafficPolicy == loadbalancer.SVCTrafficPolicyCluster &&
s.HealthCheckNodePort == 0 &&
Expand Down
2 changes: 1 addition & 1 deletion proxylib/cassandra/cassandraparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (p *CassandraParser) OnData(reply, endStream bool, dataArray [][]byte) (OpT
} else if len(parts) == 4 {
fields["query_action"] = parts[2]
fields["query_table"] = parts[3]
} else if unpreparedQuery == true {
} else if unpreparedQuery {
fields["error"] = "unknown prepared query id"
} else {
// do not log non-query accesses
Expand Down
2 changes: 1 addition & 1 deletion test/bpf_tests/gocovmerge.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int)
}

i := 0
if sortFunc(i) != true {
if !sortFunc(i) {
i = sort.Search(len(p.Blocks)-startIndex, sortFunc)
}
i += startIndex
Expand Down

0 comments on commit 0552604

Please sign in to comment.