mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
linter: Enable gofumpt and run against codebase (#1848)
* linter: Enable gofumpt and run against codebase * Address shazbert's nits * gofumpt: Fix issues after rebase
This commit is contained in:
@@ -3674,6 +3674,7 @@ func (g *Gateio) GetUnderlyingFromCurrencyPair(p currency.Pair) (currency.Pair,
|
||||
}
|
||||
return currency.Pair{Base: currency.NewCode(ccies[0]), Delimiter: currency.UnderscoreDelimiter, Quote: currency.NewCode(ccies[1])}, nil
|
||||
}
|
||||
|
||||
func getSettlementFromCurrency(currencyPair currency.Pair) (settlement currency.Code, err error) {
|
||||
quote := currencyPair.Quote.Upper().String()
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
|
||||
if !errors.Is(err, order.ErrCancelOrderIsNil) {
|
||||
t.Error(err)
|
||||
}
|
||||
var orderCancellation = &order.Cancel{
|
||||
orderCancellation := &order.Cancel{
|
||||
OrderID: "1",
|
||||
WalletAddress: core.BitcoinDonationAddress,
|
||||
AccountID: "1",
|
||||
@@ -133,6 +133,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAccountInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
@@ -290,6 +291,7 @@ func TestGetCandlesticks(t *testing.T) {
|
||||
t.Errorf("%s GetCandlesticks() error %v", g.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetTradingFeeRatio(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
@@ -405,10 +407,12 @@ func TestGetSpotOrder(t *testing.T) {
|
||||
if _, err := g.GetSpotOrder(context.Background(), "1234", currency.Pair{
|
||||
Base: currency.BTC,
|
||||
Delimiter: currency.UnderscoreDelimiter,
|
||||
Quote: currency.USDT}, asset.Spot); err != nil {
|
||||
Quote: currency.USDT,
|
||||
}, asset.Spot); err != nil {
|
||||
t.Errorf("%s GetSpotOrder() error %v", g.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAmendSpotOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := g.AmendSpotOrder(context.Background(), "", getPair(t, asset.Spot), false, &PriceAndAmount{
|
||||
@@ -431,6 +435,7 @@ func TestAmendSpotOrder(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancelSingleSpotOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
|
||||
@@ -533,7 +538,8 @@ func TestListMarginAccountBalanceChangeHistory(t *testing.T) {
|
||||
if _, err := g.ListMarginAccountBalanceChangeHistory(context.Background(), currency.BTC, currency.Pair{
|
||||
Base: currency.BTC,
|
||||
Delimiter: currency.UnderscoreDelimiter,
|
||||
Quote: currency.USDT}, time.Time{}, time.Time{}, 0, 0); err != nil {
|
||||
Quote: currency.USDT,
|
||||
}, time.Time{}, time.Time{}, 0, 0); err != nil {
|
||||
t.Errorf("%s ListMarginAccountBalanceChangeHistory() error %v", g.Name, err)
|
||||
}
|
||||
}
|
||||
@@ -983,6 +989,7 @@ func TestGetFuturesOrderbook(t *testing.T) {
|
||||
_, err = g.GetFuturesOrderbook(context.Background(), settle, getPair(t, asset.Futures).String(), "", 0, false)
|
||||
assert.NoError(t, err, "GetFuturesOrderbook should not error")
|
||||
}
|
||||
|
||||
func TestGetFuturesTradingHistory(t *testing.T) {
|
||||
t.Parallel()
|
||||
settle, err := getSettlementFromCurrency(getPair(t, asset.Futures))
|
||||
@@ -1050,6 +1057,7 @@ func TestGetLiquidationHistory(t *testing.T) {
|
||||
_, err = g.GetLiquidationHistory(context.Background(), settle, getPair(t, asset.Futures), time.Time{}, time.Time{}, 0)
|
||||
assert.NoError(t, err, "GetLiquidationHistory should not error")
|
||||
}
|
||||
|
||||
func TestQueryFuturesAccount(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
@@ -1256,6 +1264,7 @@ func TestUpdatePositionMarginInDualMode(t *testing.T) {
|
||||
_, err = g.UpdatePositionMarginInDualMode(context.Background(), settle, getPair(t, asset.Futures), 0.001, "dual_long")
|
||||
assert.NoError(t, err, "UpdatePositionMarginInDualMode should not error")
|
||||
}
|
||||
|
||||
func TestUpdatePositionLeverageInDualMode(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
|
||||
@@ -1353,12 +1362,14 @@ func TestGetSingleFuturesOrder(t *testing.T) {
|
||||
_, err := g.GetSingleFuturesOrder(context.Background(), currency.BTC, "12345")
|
||||
assert.NoError(t, err, "GetSingleFuturesOrder should not error")
|
||||
}
|
||||
|
||||
func TestCancelSingleFuturesOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
|
||||
_, err := g.CancelSingleFuturesOrder(context.Background(), currency.BTC, "12345")
|
||||
assert.NoError(t, err, "CancelSingleFuturesOrder should not error")
|
||||
}
|
||||
|
||||
func TestAmendFuturesOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
|
||||
@@ -1507,6 +1518,7 @@ func TestQueryDeliveryFuturesAccounts(t *testing.T) {
|
||||
_, err := g.GetDeliveryFuturesAccounts(context.Background(), currency.USDT)
|
||||
assert.NoError(t, err, "GetDeliveryFuturesAccounts should not error")
|
||||
}
|
||||
|
||||
func TestGetDeliveryAccountBooks(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
@@ -1748,6 +1760,7 @@ func TestCancelOptionOpenOrders(t *testing.T) {
|
||||
t.Errorf("%s CancelOptionOpenOrders() error %v", g.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetSingleOptionOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
@@ -1954,6 +1967,7 @@ func TestGetWithdrawalsHistory(t *testing.T) {
|
||||
t.Errorf("%s GetWithdrawalsHistory() error %v", g.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetRecentTrades(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := g.GetRecentTrades(context.Background(), getPair(t, asset.Spot), asset.Spot)
|
||||
@@ -2060,7 +2074,7 @@ func TestSubmitOrder(t *testing.T) {
|
||||
|
||||
func TestCancelExchangeOrder(t *testing.T) {
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
|
||||
var orderCancellation = &order.Cancel{
|
||||
orderCancellation := &order.Cancel{
|
||||
OrderID: "1",
|
||||
WalletAddress: core.BitcoinDonationAddress,
|
||||
AccountID: "1",
|
||||
@@ -2113,7 +2127,8 @@ func TestCancelBatchOrders(t *testing.T) {
|
||||
AccountID: "1",
|
||||
Pair: getPair(t, asset.Spot),
|
||||
AssetType: asset.Spot,
|
||||
}})
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("%s CancelOrder error: %v", g.Name, err)
|
||||
}
|
||||
@@ -2130,7 +2145,8 @@ func TestCancelBatchOrders(t *testing.T) {
|
||||
AccountID: "1",
|
||||
Pair: getPair(t, asset.Futures),
|
||||
AssetType: asset.Futures,
|
||||
}})
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("%s CancelOrder error: %v", g.Name, err)
|
||||
}
|
||||
@@ -2147,7 +2163,8 @@ func TestCancelBatchOrders(t *testing.T) {
|
||||
AccountID: "1",
|
||||
Pair: getPair(t, asset.DeliveryFutures),
|
||||
AssetType: asset.DeliveryFutures,
|
||||
}})
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("%s CancelOrder error: %v", g.Name, err)
|
||||
}
|
||||
@@ -2164,7 +2181,8 @@ func TestCancelBatchOrders(t *testing.T) {
|
||||
AccountID: "1",
|
||||
Pair: getPair(t, asset.Options),
|
||||
AssetType: asset.Options,
|
||||
}})
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("%s CancelOrder error: %v", g.Name, err)
|
||||
}
|
||||
@@ -2181,7 +2199,8 @@ func TestCancelBatchOrders(t *testing.T) {
|
||||
AccountID: "1",
|
||||
Pair: getPair(t, asset.Margin),
|
||||
AssetType: asset.Margin,
|
||||
}})
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("%s CancelOrder error: %v", g.Name, err)
|
||||
}
|
||||
@@ -2286,7 +2305,7 @@ func TestGetActiveOrders(t *testing.T) {
|
||||
|
||||
func TestGetOrderHistory(t *testing.T) {
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, g)
|
||||
var multiOrderRequest = order.MultiOrderRequest{
|
||||
multiOrderRequest := order.MultiOrderRequest{
|
||||
Type: order.AnyType,
|
||||
AssetType: asset.Spot,
|
||||
Side: order.Buy,
|
||||
@@ -2387,6 +2406,7 @@ func TestGetHistoricCandlesExtended(t *testing.T) {
|
||||
t.Errorf("%s GetHistoricCandlesExtended() expecting: %v, but found %v", g.Name, asset.ErrNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAvailableTransferTrains(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := g.GetAvailableTransferChains(context.Background(), currency.USDT)
|
||||
@@ -2880,6 +2900,7 @@ func TestGenerateDeliveryFuturesDefaultSubscriptions(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateFuturesDefaultSubscriptions(t *testing.T) {
|
||||
t.Parallel()
|
||||
subs, err := g.GenerateFuturesDefaultSubscriptions(currency.USDT)
|
||||
@@ -2891,6 +2912,7 @@ func TestGenerateFuturesDefaultSubscriptions(t *testing.T) {
|
||||
_, err = g.GenerateFuturesDefaultSubscriptions(currency.TABOO)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestGenerateOptionsDefaultSubscriptions(t *testing.T) {
|
||||
t.Parallel()
|
||||
if _, err := g.GenerateOptionsDefaultSubscriptions(); err != nil {
|
||||
|
||||
@@ -1101,7 +1101,8 @@ func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submi
|
||||
Settle: settle,
|
||||
ReduceOnly: s.ReduceOnly,
|
||||
TimeInForce: timeInForce,
|
||||
Text: s.ClientOrderID})
|
||||
Text: s.ClientOrderID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1109,7 +1110,7 @@ func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submi
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var status = order.Open
|
||||
status := order.Open
|
||||
if fOrder.Status != "open" {
|
||||
status, err = order.StringToOrderStatus(fOrder.FinishAs)
|
||||
if err != nil {
|
||||
@@ -1156,7 +1157,7 @@ func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submi
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var status = order.Open
|
||||
status := order.Open
|
||||
if newOrder.Status != "open" {
|
||||
status, err = order.StringToOrderStatus(newOrder.FinishAs)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user