Skip to content

Commit cd82f06

Browse files
committed
refactor: use slices.Equal to simplify code
Signed-off-by: linghuying <1599935829@qq.com>
1 parent 385ac5a commit cd82f06

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

services/horizon/internal/actions/orderbook.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package actions
22

33
import (
44
"net/http"
5+
"slices"
56

67
protocol "github.com/stellar/go/protocols/horizon"
78
"github.com/stellar/go/services/horizon/internal/context"
@@ -24,17 +25,7 @@ type OrderBookResponse struct {
2425
}
2526

2627
func priceLevelsEqual(a, b []protocol.PriceLevel) bool {
27-
if len(a) != len(b) {
28-
return false
29-
}
30-
31-
for i := range a {
32-
if a[i] != b[i] {
33-
return false
34-
}
35-
}
36-
37-
return true
28+
return slices.Equal(a, b)
3829
}
3930

4031
// Equals returns true if the OrderBookResponse is equal to `other`

0 commit comments

Comments
 (0)