build/ci: Update Go to v1.24, golangci-lint to v1.64.6 and fix issues (#1804)

* build/ci: Update Go to v1.24, golangci-lint to v1.64.5 and fix issues

* Address shazbert's nitters

* linter/config: Fix new linter issue and use versionSize const

* Address gk's nitters and fix additional linter issue after rebase

* Address glorious nits

* staticcheck: Fix additional linter issues after upgrading to Go 1.24.1 and golangci-lint v1.64.6

Also addresses nits

* Improve testing, assertify usage and use common.ErrParsingWSField

* TestCreateNewStrategy: Replace must > should wording
This commit is contained in:
Adrian Gallagher
2025-03-10 16:33:55 +11:00
committed by GitHub
parent c086e281cf
commit d64d56f77c
114 changed files with 5080 additions and 9355 deletions

View File

@@ -608,7 +608,7 @@ func BenchmarkReverse(b *testing.B) {
b.Fatal("incorrect length")
}
for i := 0; i < b.N; i++ {
for b.Loop() {
s.Reverse()
}
}
@@ -618,7 +618,7 @@ func BenchmarkReverse(b *testing.B) {
func BenchmarkSortAsksDecending(b *testing.B) {
s := deploySliceOrdered()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortAsks()
}
@@ -630,7 +630,7 @@ func BenchmarkSortBidsAscending(b *testing.B) {
s := deploySliceOrdered()
s.Reverse()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortBids()
}
@@ -641,7 +641,7 @@ func BenchmarkSortBidsAscending(b *testing.B) {
func BenchmarkSortAsksStandard(b *testing.B) {
s := deployUnorderedSlice()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortAsks()
}
@@ -652,7 +652,7 @@ func BenchmarkSortAsksStandard(b *testing.B) {
func BenchmarkSortBidsStandard(b *testing.B) {
s := deployUnorderedSlice()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortBids()
}
@@ -663,7 +663,7 @@ func BenchmarkSortBidsStandard(b *testing.B) {
func BenchmarkSortAsksAscending(b *testing.B) {
s := deploySliceOrdered()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortAsks()
}
@@ -675,7 +675,7 @@ func BenchmarkSortBidsDescending(b *testing.B) {
s := deploySliceOrdered()
s.Reverse()
bucket := make(Tranches, len(s))
for i := 0; i < b.N; i++ {
for b.Loop() {
copy(bucket, s)
bucket.SortBids()
}

View File

@@ -104,7 +104,7 @@ func TestLoad(t *testing.T) {
// 84119028 13.87 ns/op 0 B/op 0 allocs/op (new)
func BenchmarkLoad(b *testing.B) {
ts := Tranches{}
for i := 0; i < b.N; i++ {
for b.Loop() {
ts.load(ask)
}
}
@@ -262,7 +262,7 @@ func BenchmarkUpdateInsertByPrice_Amend(b *testing.B) {
},
}
for i := 0; i < b.N; i++ {
for b.Loop() {
a.updateInsertByPrice(updates, 0)
}
}
@@ -285,7 +285,7 @@ func BenchmarkUpdateInsertByPrice_Insert_Delete(b *testing.B) {
},
}
for i := 0; i < b.N; i++ {
for b.Loop() {
a.updateInsertByPrice(updates, 0)
}
}
@@ -357,7 +357,7 @@ func BenchmarkUpdateByID(b *testing.B) {
}
asks.load(asksSnapshot)
for i := 0; i < b.N; i++ {
for b.Loop() {
err := asks.updateByID(asksSnapshot)
if err != nil {
b.Fatal(err)
@@ -427,7 +427,7 @@ func BenchmarkDeleteByID(b *testing.B) {
}
asks.load(asksSnapshot)
for i := 0; i < b.N; i++ {
for b.Loop() {
err := asks.deleteByID(asksSnapshot, false)
if err != nil {
b.Fatal(err)
@@ -702,7 +702,7 @@ func BenchmarkUpdateInsertByID_asks(b *testing.B) {
}
asks.load(asksSnapshot)
for i := 0; i < b.N; i++ {
for b.Loop() {
err := asks.updateInsertByID(asksSnapshot, askCompare)
if err != nil {
b.Fatal(err)
@@ -974,7 +974,7 @@ func BenchmarkUpdateInsertByID_bids(b *testing.B) {
}
bids.load(bidsSnapshot)
for i := 0; i < b.N; i++ {
for b.Loop() {
err := bids.updateInsertByID(bidsSnapshot, bidCompare)
if err != nil {
b.Fatal(err)
@@ -1878,7 +1878,7 @@ func BenchmarkRetrieve(b *testing.B) {
}
asks.load(asksSnapshot)
for i := 0; i < b.N; i++ {
for b.Loop() {
_ = asks.retrieve(6)
}
}