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

Optimize the comparison mode of bool judgment #22922

Merged
merged 1 commit into from
Jan 9, 2023
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 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