CI: Fix golangci-lint linter issues, add prealloc linter and bump version depends for Go 1.18 (#915)

* Bump CI versions

* Specifically set go version as 1.17.x bumps it to 1.18

* Another

* Adjust AppVeyor

* Part 1 of linter issues

* Part 2

* Fix various linters and improvements

* Part 3

* Finishing touches

* Tests and EqualFold

* Fix nitterinos plus bonus requester jobs bump for exchanges with large number of tests

* Fix nitterinos and bump golangci-lint timeout for AppVeyor

* Address nits, ensure all books are returned on err due to syncer regression

* Fix the wiggins

* Fix duplication

* Fix nitterinos
This commit is contained in:
Adrian Gallagher
2022-04-20 13:45:15 +10:00
committed by GitHub
parent c48e5ea90a
commit 9a4eb9de84
216 changed files with 3493 additions and 2424 deletions

View File

@@ -336,20 +336,20 @@ func (b *Bithumb) UpdateOrderbook(ctx context.Context, p currency.Pair, assetTyp
return book, err
}
book.Bids = make(orderbook.Items, len(orderbookNew.Data.Bids))
for i := range orderbookNew.Data.Bids {
book.Bids = append(book.Bids,
orderbook.Item{
Amount: orderbookNew.Data.Bids[i].Quantity,
Price: orderbookNew.Data.Bids[i].Price,
})
book.Bids[i] = orderbook.Item{
Amount: orderbookNew.Data.Bids[i].Quantity,
Price: orderbookNew.Data.Bids[i].Price,
}
}
book.Asks = make(orderbook.Items, len(orderbookNew.Data.Asks))
for i := range orderbookNew.Data.Asks {
book.Asks = append(book.Asks,
orderbook.Item{
Amount: orderbookNew.Data.Asks[i].Quantity,
Price: orderbookNew.Data.Asks[i].Price,
})
book.Asks[i] = orderbook.Item{
Amount: orderbookNew.Data.Asks[i].Quantity,
Price: orderbookNew.Data.Asks[i].Price,
}
}
err = book.Process()
@@ -368,7 +368,7 @@ func (b *Bithumb) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (
return info, err
}
var exchangeBalances []account.Balance
exchangeBalances := make([]account.Balance, 0, len(bal.Total))
for key, totalAmount := range bal.Total {
hold, ok := bal.InUse[key]
if !ok {
@@ -435,7 +435,7 @@ func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetTyp
if err != nil {
return nil, err
}
var resp []trade.Data
resp := make([]trade.Data, len(tradeData.Data))
for i := range tradeData.Data {
var side order.Side
side, err = order.StringToOrderSide(tradeData.Data[i].Type)
@@ -447,7 +447,7 @@ func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetTyp
if err != nil {
return nil, err
}
resp = append(resp, trade.Data{
resp[i] = trade.Data{
Exchange: b.Name,
CurrencyPair: p,
AssetType: assetType,
@@ -455,7 +455,7 @@ func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetTyp
Price: tradeData.Data[i].Price,
Amount: tradeData.Data[i].UnitsTraded,
Timestamp: t,
})
}
}
err = b.AddTradesToBuffer(resp...)