Skip to content

Commit

Permalink
update signature of slices.SortFunc
Browse files Browse the repository at this point in the history
* was seeing build failures locally and in CI due to
golang/go#61374

* had to bump to go 1.21 to leverage the `cmp` lib

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Oct 31, 2023
1 parent 71c727c commit 2915591
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/envoyproxy/gateway

go 1.20
go 1.21

require (
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4
Expand Down
17 changes: 9 additions & 8 deletions internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package ir

import (
"cmp"
"errors"
"net"
"reflect"
Expand Down Expand Up @@ -79,19 +80,19 @@ func (x *Xds) Equal(y *Xds) bool {

// sort ensures the listeners are in a consistent order.
func (x *Xds) sort() {
slices.SortFunc(x.HTTP, func(l1, l2 *HTTPListener) bool {
return l1.Name < l2.Name
slices.SortFunc(x.HTTP, func(l1, l2 *HTTPListener) int {
return cmp.Compare(l1.Name, l2.Name)
})
for _, l := range x.HTTP {
slices.SortFunc(l.Routes, func(r1, r2 *HTTPRoute) bool {
return r1.Name < r2.Name
slices.SortFunc(l.Routes, func(r1, r2 *HTTPRoute) int {
return cmp.Compare(r1.Name, r2.Name)
})
}
slices.SortFunc(x.TCP, func(l1, l2 *TCPListener) bool {
return l1.Name < l2.Name
slices.SortFunc(x.TCP, func(l1, l2 *TCPListener) int {
return cmp.Compare(l1.Name, l2.Name)
})
slices.SortFunc(x.UDP, func(l1, l2 *UDPListener) bool {
return l1.Name < l2.Name
slices.SortFunc(x.UDP, func(l1, l2 *UDPListener) int {
return cmp.Compare(l1.Name, l2.Name)
})
}

Expand Down
2 changes: 1 addition & 1 deletion tools/github-actions/setup-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ runs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20.x
go-version: 1.21.x
cache: true

0 comments on commit 2915591

Please sign in to comment.