CI: Bump go version, linters and fix minor issues (#1130)

* CI: Bump go version, linters and fix minor issues

* Bump version, fix loop variables

* Revert

* Rid TODOs now that 1.51 has been released
This commit is contained in:
Adrian Gallagher
2023-02-03 15:56:59 +11:00
committed by GitHub
parent b384991183
commit 7e08e483fb
39 changed files with 71 additions and 71 deletions

View File

@@ -467,7 +467,7 @@ func (a *Alphapoint) CancelExistingOrder(ctx context.Context, orderID int64, oms
return response.CancelOrderID, nil
}
// CancelAllExistingOrders cancels all open orders by symbol
// CancelAllExistingOrders cancels all open orders by symbol.
// symbol - Instrument code (ex: “BTCUSD”)
func (a *Alphapoint) CancelAllExistingOrders(ctx context.Context, omsid string) error {
req := make(map[string]interface{})

View File

@@ -1745,7 +1745,7 @@ func TestReOrderbyID(t *testing.T) {
func TestPopulateAcceptableMethods(t *testing.T) {
t.Parallel()
if acceptableMethods.loaded() {
// we may have have been loaded from another test, so reset
// we may have been loaded from another test, so reset
acceptableMethods.m.Lock()
acceptableMethods.a = make(map[string][]string)
acceptableMethods.m.Unlock()

View File

@@ -189,7 +189,7 @@ func (b *Bitmex) SendTrollboxMessage(ctx context.Context, params ChatSendParams)
&messages)
}
// GetTrollboxChannels the channels from the the bitmex trollbox
// GetTrollboxChannels the channels from the bitmex trollbox
func (b *Bitmex) GetTrollboxChannels(ctx context.Context) ([]ChatChannel, error) {
var channels []ChatChannel
@@ -198,7 +198,7 @@ func (b *Bitmex) GetTrollboxChannels(ctx context.Context) ([]ChatChannel, error)
&channels)
}
// GetTrollboxConnectedUsers the channels from the the bitmex trollbox
// GetTrollboxConnectedUsers the channels from the bitmex trollbox
func (b *Bitmex) GetTrollboxConnectedUsers(ctx context.Context) (ConnectedUsers, error) {
var users ConnectedUsers

View File

@@ -241,7 +241,7 @@ type IndexComposite struct {
Weight float64 `json:"weight"`
}
// Insurance Insurance Fund Data
// Insurance stores insurance fund data
type Insurance struct {
Currency string `json:"currency"`
Timestamp time.Time `json:"timestamp"`

View File

@@ -483,7 +483,7 @@ func (b *Bitstamp) OpenInternationalBankWithdrawal(ctx context.Context, amount f
return resp, b.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, bitstampAPIOpenWithdrawal, true, req, &resp)
}
// GetCryptoDepositAddress returns a depositing address by crypto
// GetCryptoDepositAddress returns a depositing address by crypto.
// crypto - example "btc", "ltc", "eth", "xrp" or "bch"
func (b *Bitstamp) GetCryptoDepositAddress(ctx context.Context, crypto currency.Code) (*DepositAddress, error) {
path := crypto.Lower().String() + "_address"

View File

@@ -826,10 +826,7 @@ func (b *BTCMarkets) GetActiveOrders(ctx context.Context, req *order.GetOrdersRe
if err != nil {
return nil, err
}
for a := range allPairs {
req.Pairs = append(req.Pairs,
allPairs[a])
}
req.Pairs = append(req.Pairs, allPairs...)
}
var resp []order.Detail

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"math/rand"
"sort"
"strconv"
"strings"
@@ -131,7 +130,6 @@ func (c *COINUT) SetDefaults() {
c.WebsocketResponseMaxLimit = exchange.DefaultWebsocketResponseMaxLimit
c.WebsocketResponseCheckTimeout = exchange.DefaultWebsocketResponseCheckTimeout
c.WebsocketOrderbookBufferLimit = exchange.DefaultWebsocketOrderbookBufferLimit
rand.Seed(time.Now().UnixNano())
}
// Setup sets the current exchange configuration

View File

@@ -1014,7 +1014,7 @@ func (b *Base) StoreAssetPairFormat(a asset.Item, f currency.PairStore) error {
}
// SetGlobalPairsManager sets defined asset and pairs management system with
// with global formatting
// global formatting
func (b *Base) SetGlobalPairsManager(request, config *currency.PairFormat, assets ...asset.Item) error {
if request == nil {
return fmt.Errorf("%s cannot set pairs manager, request pair format not provided",

View File

@@ -173,7 +173,7 @@ func TestSetDefaultEndpoints(t *testing.T) {
EdgeCase1: "",
})
if err != nil {
t.Errorf("expecting a warning due due to invalid url val but got an error: %v", err)
t.Errorf("expecting a warning due to invalid url value but got an error: %v", err)
}
}

View File

@@ -46,7 +46,7 @@ const (
// Gemini is the overarching type across the Gemini package, create multiple
// instances with differing APIkeys for segregation of roles for authenticated
// requests & sessions by appending new sessions to the Session map using
// AddSession, if sandbox test is needed append a new session with with the same
// AddSession. If sandbox test is needed, append a new session with the same
// API keys and change the IsSandbox variable to true.
type Gemini struct {
exchange.Base

View File

@@ -905,7 +905,7 @@ func (h *HUOBI) FGetOpenOrders(ctx context.Context, symbol currency.Code, pageIn
return resp, h.FuturesAuthenticatedHTTPRequest(ctx, exchange.RestFutures, http.MethodPost, fQueryOpenOrders, nil, req, &resp)
}
// FGetOrderHistory gets order order history for futures
// FGetOrderHistory gets order history for futures
func (h *HUOBI) FGetOrderHistory(ctx context.Context, contractCode currency.Pair, symbol, tradeType, reqType, orderType string, status []order.Status, createDate, pageIndex, pageSize int64) (FOrderHistoryData, error) {
var resp FOrderHistoryData
req := make(map[string]interface{})

View File

@@ -568,7 +568,7 @@ type Trade struct {
Timestamp int64 `json:"ts"`
}
// TradeHistory stores the the trade history data
// TradeHistory stores the trade history data
type TradeHistory struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`

View File

@@ -487,7 +487,7 @@ func (i *ItBit) GetOrderInfo(ctx context.Context, orderID string, pair currency.
// GetDepositAddress returns a deposit address for a specified currency
// NOTE: This has not been implemented due to the fact you need to generate a
// a specific wallet ID and they restrict the amount of deposit address you can
// specific wallet ID and they restrict the amount of deposit addresses you can
// request limiting them to 2.
func (i *ItBit) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error) {
return nil, common.ErrNotYetImplemented

View File

@@ -96,7 +96,6 @@ func TestCreateKline(t *testing.T) {
tradeTotal := 24000
var trades []order.TradeHistory
rand.Seed(time.Now().Unix())
execution := time.Now()
for i := 0; i < tradeTotal; i++ {
price, rndTime := 1000+float64(rand.Intn(1000)), rand.Intn(10) //nolint:gosec // no need to import crypo/rand for testing

View File

@@ -333,7 +333,7 @@ func (k *Item) GetRelativeStrengthIndexOnClose(period int64) ([]float64, error)
return ohlc.GetRelativeStrengthIndex(ohlc.Close, period)
}
// GetRelativeStrengthIndex returns the relative strength index from the the
// GetRelativeStrengthIndex returns the relative strength index from the
// given price set and period.
func (o *OHLC) GetRelativeStrengthIndex(option []float64, period int64) ([]float64, error) {
if o == nil {

View File

@@ -1958,7 +1958,7 @@ func (ok *Okx) EstimatedDeliveryExercisePriceSubscription(operation string, asse
return ok.wsChannelSubscription(operation, okxChannelEstimatedPrice, assetType, pair, true, true, false)
}
// MarkPriceSubscription to subscribe or unsubscribe to to "mark-price" to retrieve the mark price. Data will be pushed every 200 ms when the mark price changes, and will be pushed every 10 seconds when the mark price does not change.
// MarkPriceSubscription to subscribe or unsubscribe to the "mark-price" to retrieve the mark price. Data will be pushed every 200 ms when the mark price changes, and will be pushed every 10 seconds when the mark price does not change.
func (ok *Okx) MarkPriceSubscription(operation string, assetType asset.Item, pair currency.Pair) error {
return ok.wsChannelSubscription(operation, okxChannelMarkPrice, assetType, pair, false, true, false)
}

View File

@@ -1665,6 +1665,7 @@ func TestIsOrderPlaced(t *testing.T) {
}
// specific tests
for num, tt := range statusTests {
num := num
tt := tt
t.Run(fmt.Sprintf("TEST CASE: %d", num), func(t *testing.T) {
t.Parallel()

View File

@@ -556,7 +556,6 @@ func TestProcessOrderbook(t *testing.T) {
func deployUnorderedSlice() Items {
var items []Item
rand.Seed(time.Now().UnixNano())
for i := 0; i < 1000; i++ {
items = append(items, Item{Amount: 1, Price: rand.Float64(), ID: rand.Int63()}) //nolint:gosec // Not needed in tests
}
@@ -593,7 +592,6 @@ func TestSorting(t *testing.T) {
}
func deploySliceOrdered() Items {
rand.Seed(time.Now().UnixNano())
var items []Item
for i := 0; i < 1000; i++ {
items = append(items, Item{Amount: 1, Price: float64(i + 1), ID: rand.Int63()}) //nolint:gosec // Not needed in tests

View File

@@ -70,8 +70,8 @@ type RetryPolicy func(resp *http.Response, err error) (bool, error)
type RequesterOption func(*Requester)
// Generate defines a closure for functionality outside of the requester to
// to generate new *http.Request on every attempt. This minimizes the chance of
// being outside of receive window if application rate limiting reduces outbound
// generate a new *http.Request on every attempt. This minimizes the chance of
// being outside of the receive window if application rate limiting reduces outbound
// requests.
type Generate func() (*Item, error)

View File

@@ -895,7 +895,6 @@ func TestEnsureMultipleUpdatesViaPrice(t *testing.T) {
}
func deploySliceOrdered(size int) orderbook.Items {
rand.Seed(time.Now().UnixNano())
var items []orderbook.Item
for i := 0; i < size; i++ {
items = append(items, orderbook.Item{Amount: 1, Price: rand.Float64() + float64(i), ID: rand.Int63()}) //nolint:gosec // Not needed for tests

View File

@@ -953,7 +953,7 @@ func (w *ChannelSubscription) Equal(s *ChannelSubscription) bool {
}
// GetSubscriptions returns a copied list of subscriptions
// subscriptions is a private member and cannot be manipulated
// and is a private member that cannot be manipulated
func (w *Websocket) GetSubscriptions() []ChannelSubscription {
w.subscriptionMutex.Lock()
defer w.subscriptionMutex.Unlock()