mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 07:26:48 +00:00
linters: Exclude govet shadow check on exchange instances (#2097)
* Linters: Exclude govet shadow check on e in tests
* Linters: Remove nolint rule for new(Exchange) in tests
Replay with:
```
perl -pi -e 's{(\se\s:=\s.*?)\s*//nolint:govet // Intentional shadow.*}{$1}' **/*_test.go
```
This commit is contained in:
@@ -2088,7 +2088,7 @@ func TestCrossMarginBalanceLoan(t *testing.T) {
|
||||
// TestFuturesDataHandler ensures that messages from various futures channels do not error
|
||||
func TestFuturesDataHandler(t *testing.T) {
|
||||
t.Parallel()
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
|
||||
testexch.FixtureToDataHandler(t, "testdata/wsFutures.json", func(ctx context.Context, m []byte) error {
|
||||
if strings.Contains(string(m), "futures.balances") {
|
||||
@@ -2283,7 +2283,7 @@ func TestOptionsPongPushData(t *testing.T) {
|
||||
func TestGenerateSubscriptionsSpot(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
|
||||
|
||||
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
|
||||
@@ -2343,7 +2343,7 @@ func TestGenerateDeliveryFuturesDefaultSubscriptions(t *testing.T) {
|
||||
|
||||
func TestGenerateFuturesDefaultSubscriptions(t *testing.T) {
|
||||
t.Parallel()
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
|
||||
subs, err := e.GenerateFuturesDefaultSubscriptions(asset.USDTMarginedFutures)
|
||||
require.NoError(t, err)
|
||||
@@ -3608,7 +3608,7 @@ func TestWebsocketSubmitOrders(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
sub.AssetType = asset.Spot
|
||||
cpy.AssetType = asset.Spot
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestWebsocketFuturesSubmitOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
out.AutoSize = ""
|
||||
|
||||
got, err := e.WebsocketFuturesSubmitOrder(t.Context(), asset.USDTMarginedFutures, out)
|
||||
@@ -73,7 +73,7 @@ func TestWebsocketFuturesSubmitOrders(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
// test single order
|
||||
got, err := e.WebsocketFuturesSubmitOrders(t.Context(), asset.CoinMarginedFutures, out)
|
||||
@@ -99,7 +99,7 @@ func TestWebsocketFuturesCancelOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
got, err := e.WebsocketFuturesCancelOrder(t.Context(), "513160761072", BTCUSDT, asset.USDTMarginedFutures)
|
||||
require.NoError(t, err)
|
||||
@@ -119,7 +119,7 @@ func TestWebsocketFuturesCancelAllOpenFuturesOrders(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
got, err := e.WebsocketFuturesCancelAllOpenFuturesOrders(t.Context(), BTCUSDT, asset.USDTMarginedFutures, order.Bid.Lower())
|
||||
require.NoError(t, err)
|
||||
@@ -151,7 +151,7 @@ func TestWebsocketFuturesAmendOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
amend.OrderID = "513170215869"
|
||||
got, err := e.WebsocketFuturesAmendOrder(t.Context(), amend)
|
||||
@@ -178,7 +178,7 @@ func TestWebsocketFuturesOrderList(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
list.Status = statusOpen
|
||||
got, err := e.WebsocketFuturesOrderList(t.Context(), list)
|
||||
@@ -199,7 +199,7 @@ func TestWebsocketFuturesGetOrderStatus(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
|
||||
|
||||
got, err := e.WebsocketFuturesGetOrderStatus(t.Context(), BTCUSDT, asset.USDTMarginedFutures, "513170215869")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestWebsocketLogin(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
c, err := e.Websocket.GetConnection(asset.Spot)
|
||||
require.NoError(t, err)
|
||||
@@ -50,7 +50,7 @@ func TestWebsocketSpotSubmitOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
got, err := e.WebsocketSpotSubmitOrder(t.Context(), out)
|
||||
require.NoError(t, err)
|
||||
@@ -78,7 +78,7 @@ func TestWebsocketSpotSubmitOrders(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
// test single order
|
||||
got, err := e.WebsocketSpotSubmitOrders(t.Context(), out)
|
||||
@@ -100,7 +100,7 @@ func TestWebsocketSpotCancelOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
got, err := e.WebsocketSpotCancelOrder(t.Context(), "644913098758", BTCUSDT, "")
|
||||
require.NoError(t, err)
|
||||
@@ -122,7 +122,7 @@ func TestWebsocketSpotCancelAllOrdersByIDs(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
out.OrderID = "644913101755"
|
||||
got, err := e.WebsocketSpotCancelAllOrdersByIDs(t.Context(), []WebsocketOrderBatchRequest{out})
|
||||
@@ -137,7 +137,7 @@ func TestWebsocketSpotCancelAllOrdersByPair(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
got, err := e.WebsocketSpotCancelAllOrdersByPair(t.Context(), currency.EMPTYPAIR, order.Buy, "")
|
||||
require.NoError(t, err)
|
||||
@@ -166,7 +166,7 @@ func TestWebsocketSpotAmendOrder(t *testing.T) {
|
||||
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
amend.OrderID = "645029162673"
|
||||
got, err := e.WebsocketSpotAmendOrder(t.Context(), amend)
|
||||
@@ -185,7 +185,7 @@ func TestWebsocketSpotGetOrderStatus(t *testing.T) {
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
||||
|
||||
testexch.UpdatePairsOnce(t, e)
|
||||
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
|
||||
e := newExchangeWithWebsocket(t, asset.Spot)
|
||||
|
||||
got, err := e.WebsocketSpotGetOrderStatus(t.Context(), "644999650452", BTCUSDT, "")
|
||||
require.NoError(t, err)
|
||||
@@ -199,7 +199,7 @@ func newExchangeWithWebsocket(t *testing.T, a asset.Item) *Exchange {
|
||||
if apiKey == "" || apiSecret == "" {
|
||||
t.Skip()
|
||||
}
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
|
||||
testexch.UpdatePairsOnce(t, e)
|
||||
e.API.AuthenticatedSupport = true
|
||||
|
||||
@@ -50,7 +50,7 @@ type websocketBalancesTest struct {
|
||||
|
||||
func TestProcessSpotBalances(t *testing.T) { //nolint:tparallel // Sequential tests, do not use t.Parallel(); Some timestamps are deliberately identical from trading activity
|
||||
t.Parallel()
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
e.SetDefaults()
|
||||
e.Name = "ProcessSpotBalancesTest"
|
||||
e.Accounts = accounts.MustNewAccounts(e)
|
||||
@@ -120,7 +120,7 @@ func TestProcessSpotBalances(t *testing.T) { //nolint:tparallel // Sequential te
|
||||
|
||||
func TestProcessBalancePushData(t *testing.T) { //nolint:tparallel // Sequential tests, do not use t.Parallel(); Some timestamps are deliberately identical from trading activity
|
||||
t.Parallel()
|
||||
e := new(Exchange) //nolint:govet // Intentional shadow
|
||||
e := new(Exchange)
|
||||
e.SetDefaults()
|
||||
e.Name = "ProcessFuturesBalancesTest"
|
||||
e.Accounts = accounts.MustNewAccounts(e)
|
||||
|
||||
Reference in New Issue
Block a user