Skip to content

Commit

Permalink
internal: replace min/max funcs with built-in ones (#6062)
Browse files Browse the repository at this point in the history
Signed-off-by: gang.liu <[email protected]>
  • Loading branch information
izturn authored Jan 9, 2024
1 parent af0ffe0 commit b054178
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
7 changes: 0 additions & 7 deletions internal/envoy/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ func truncate(l int, s, suffix string) string {
return s[:l-len(suffix)-1] + "-" + suffix
}

func min(a, b int) int {
if a > b {
return b
}
return a
}

// AnyPositive indicates if any of the values provided are greater than zero.
func AnyPositive(first uint32, rest ...uint32) bool {
if first > 0 {
Expand Down
14 changes: 0 additions & 14 deletions internal/xdscache/v3/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,20 +365,6 @@ func (c *ListenerCache) OnChange(root *dag.DAG) {
cfg := c.Config
listeners := map[string]*envoy_listener_v3.Listener{}

max := func(a, b envoy_tls_v3.TlsParameters_TlsProtocol) envoy_tls_v3.TlsParameters_TlsProtocol {
if a > b {
return a
}
return b
}

min := func(a, b envoy_tls_v3.TlsParameters_TlsProtocol) envoy_tls_v3.TlsParameters_TlsProtocol {
if a < b {
return a
}
return b
}

socketOptions := envoy_v3.NewSocketOptions().TCPKeepalive()
if cfg.SocketOptions != nil {
socketOptions = socketOptions.TOS(cfg.SocketOptions.TOS).TrafficClass(cfg.SocketOptions.TrafficClass)
Expand Down

0 comments on commit b054178

Please sign in to comment.