CI/build: Update Go version, linters and fix minor issues (#1473)

* CI/build: Update Go version, linters and fix minor issues

* Bump golangci-lint to v1.56.1

* BinanceUS: Make uint usage consistent

* Throw blank identifiers into the trash
This commit is contained in:
Adrian Gallagher
2024-02-14 11:02:06 +11:00
committed by GitHub
parent 9ff502bac2
commit 08da42ddb7
79 changed files with 364 additions and 374 deletions

View File

@@ -141,7 +141,7 @@ func (b *Binance) GetOrderBook(ctx context.Context, obd OrderBookDataRequestPara
return nil, err
}
params.Set("symbol", symbol)
params.Set("limit", fmt.Sprintf("%d", obd.Limit))
params.Set("limit", strconv.Itoa(obd.Limit))
var resp OrderBookData
if err := b.SendHTTPRequest(ctx,
@@ -202,7 +202,7 @@ func (b *Binance) GetMostRecentTrades(ctx context.Context, rtr RecentTradeReques
return nil, err
}
params.Set("symbol", symbol)
params.Set("limit", fmt.Sprintf("%d", rtr.Limit))
params.Set("limit", strconv.Itoa(rtr.Limit))
path := recentTrades + "?" + params.Encode()
@@ -221,10 +221,10 @@ func (b *Binance) GetHistoricalTrades(ctx context.Context, symbol string, limit
params := url.Values{}
params.Set("symbol", symbol)
params.Set("limit", fmt.Sprintf("%d", limit))
params.Set("limit", strconv.Itoa(limit))
// else return most recent trades
if fromID > 0 {
params.Set("fromId", fmt.Sprintf("%d", fromID))
params.Set("fromId", strconv.FormatInt(fromID, 10))
}
path := historicalTrades + "?" + params.Encode()

View File

@@ -1462,7 +1462,7 @@ func TestGetHistoricTrades(t *testing.T) {
if mockTests {
expected = 1002
}
assert.Equal(t, expected, len(result), "GetHistoricTrades should return correct number of entries") // assert.Len doesn't produce clear messages on result
assert.Equal(t, expected, len(result), "GetHistoricTrades should return correct number of entries") //nolint:testifylint // assert.Len doesn't produce clear messages on result
for _, r := range result {
if !assert.WithinRange(t, r.Timestamp, start, end, "All trades should be within time range") {
break

View File

@@ -965,7 +965,7 @@ func (b *Binance) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Subm
case order.Sell:
reqSide = "SELL"
default:
return nil, fmt.Errorf("invalid side")
return nil, errors.New("invalid side")
}
var (
@@ -1018,7 +1018,7 @@ func (b *Binance) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Subm
case order.Sell:
reqSide = "SELL"
default:
return nil, fmt.Errorf("invalid side")
return nil, errors.New("invalid side")
}
var oType string
switch s.Type {
@@ -1549,7 +1549,7 @@ func (b *Binance) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequ
return nil, errors.New("endTime cannot be before startTime")
}
if time.Since(req.StartTime) > time.Hour*24*30 {
return nil, fmt.Errorf("can only fetch orders 30 days out")
return nil, errors.New("can only fetch orders 30 days out")
}
orderHistory, err = b.GetAllFuturesOrders(ctx,
req.Pairs[i], currency.EMPTYPAIR, req.StartTime, req.EndTime, 0, 0)
@@ -1567,7 +1567,7 @@ func (b *Binance) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequ
return nil, err
}
default:
return nil, fmt.Errorf("invalid combination of input params")
return nil, errors.New("invalid combination of input params")
}
for y := range orderHistory {
var feeBuilder exchange.FeeBuilder
@@ -1607,7 +1607,7 @@ func (b *Binance) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequ
return nil, errors.New("endTime cannot be before startTime")
}
if time.Since(req.StartTime) > time.Hour*24*7 {
return nil, fmt.Errorf("can only fetch orders 7 days out")
return nil, errors.New("can only fetch orders 7 days out")
}
orderHistory, err = b.UAllAccountOrders(ctx,
req.Pairs[i], 0, 0, req.StartTime, req.EndTime)
@@ -1625,7 +1625,7 @@ func (b *Binance) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequ
return nil, err
}
default:
return nil, fmt.Errorf("invalid combination of input params")
return nil, errors.New("invalid combination of input params")
}
for y := range orderHistory {
var feeBuilder exchange.FeeBuilder