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:
Adrian Gallagher
2025-03-18 10:23:16 +11:00
committed by GitHub
parent 748ed71455
commit f5faca2eb2
189 changed files with 1541 additions and 1104 deletions

View File

@@ -978,7 +978,7 @@ func getOfflineTradeFee(price, amount float64) float64 {
// calculateTradingFee returns the fee for trading any currency on Bitmex
func calculateTradingFee(purchasePrice, amount float64, isMaker bool) float64 {
var fee = 0.000750
fee := 0.000750
if isMaker {
fee -= 0.000250
}

View File

@@ -597,7 +597,6 @@ func (p OrderBookGetL2Params) IsNil() bool {
// PositionGetParams contains all the parameters to send to the API endpoint
type PositionGetParams struct {
// Columns - Which columns to fetch. For example, send ["columnName"].
Columns string `json:"columns,omitempty"`

View File

@@ -121,7 +121,8 @@ func TestSendTrollboxMessage(t *testing.T) {
_, err := b.SendTrollboxMessage(context.Background(),
ChatSendParams{
ChannelID: 1337,
Message: "Hello,World!"})
Message: "Hello,World!",
})
require.Error(t, err)
}
@@ -244,10 +245,12 @@ func TestCreateOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
_, err := b.CreateOrder(context.Background(),
&OrderNewParams{Symbol: "XBTM15",
&OrderNewParams{
Symbol: "XBTM15",
Price: 219.0,
ClientOrderID: "mm_bitmex_1a/oemUeQ4CAJZgP3fjHsA",
OrderQuantity: 98})
OrderQuantity: 98,
})
require.Error(t, err)
}
@@ -401,7 +404,7 @@ func setFeeBuilder() *exchange.FeeBuilder {
// TestGetFeeByTypeOfflineTradeFee logic test
func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
t.Parallel()
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
_, err := b.GetFeeByType(context.Background(), feeBuilder)
require.NoError(t, err)
if !sharedtestvalues.AreAPICredentialsSet(b) {
@@ -413,7 +416,7 @@ func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
func TestGetFee(t *testing.T) {
t.Parallel()
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
// CryptocurrencyTradeFee Basic
_, err := b.GetFee(feeBuilder)
require.NoError(t, err)
@@ -474,7 +477,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
func TestGetActiveOrders(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
Type: order.AnyType,
AssetType: asset.Spot,
Side: order.AnySide,
@@ -490,7 +493,7 @@ func TestGetActiveOrders(t *testing.T) {
func TestGetOrderHistory(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
Type: order.AnyType,
Pairs: []currency.Pair{currency.NewPair(currency.LTC, currency.BTC)},
AssetType: asset.Spot,
@@ -512,7 +515,7 @@ func TestSubmitOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
var orderSubmission = &order.Submit{
orderSubmission := &order.Submit{
Exchange: b.Name,
Pair: currency.Pair{
Base: currency.XBT,
@@ -539,7 +542,7 @@ func TestCancelExchangeOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "123456789012345678901234567890123456",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -560,7 +563,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "123456789012345678901234567890123456",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -614,7 +617,7 @@ func TestWithdraw(t *testing.T) {
Amount: -1,
Currency: currency.BTC,
Description: "WITHDRAW IT ALL",
OneTimePassword: 000000, //nolint // gocritic false positive
OneTimePassword: 696969,
}
_, err := b.WithdrawCryptocurrencyFunds(context.Background(), &withdrawCryptoRequest)
@@ -629,7 +632,7 @@ func TestWithdrawFiat(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := b.WithdrawFiatFunds(context.Background(), &withdrawFiatRequest)
require.ErrorIs(t, err, common.ErrFunctionNotSupported)
}
@@ -638,7 +641,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, b, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := b.WithdrawFiatFundsToInternationalBank(context.Background(),
&withdrawFiatRequest)
require.ErrorIs(t, err, common.ErrFunctionNotSupported)

View File

@@ -363,7 +363,8 @@ instruments:
LastUpdated: tick[j].Timestamp,
ExchangeName: b.Name,
OpenInterest: tick[j].OpenInterest,
AssetType: a})
AssetType: a,
})
if err != nil {
return err
}
@@ -412,7 +413,8 @@ func (b *Bitmex) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType
orderbookNew, err := b.GetOrderbook(ctx,
OrderBookGetL2Params{
Symbol: fPair.String(),
Depth: 500})
Depth: 500,
})
if err != nil {
return book, err
}
@@ -639,7 +641,7 @@ func (b *Bitmex) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submi
return nil, err
}
var orderNewParams = OrderNewParams{
orderNewParams := OrderNewParams{
OrderType: s.Type.Title(),
Symbol: fPair.String(),
OrderQuantity: s.Amount,
@@ -671,7 +673,8 @@ func (b *Bitmex) ModifyOrder(ctx context.Context, action *order.Modify) (*order.
o, err := b.AmendOrder(ctx, &OrderAmendParams{
OrderID: action.OrderID,
OrderQty: int32(action.Amount),
Price: action.Price})
Price: action.Price,
})
if err != nil {
return nil, err
}
@@ -817,7 +820,7 @@ func (b *Bitmex) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawReques
if err := withdrawRequest.Validate(); err != nil {
return nil, err
}
var r = UserRequestWithdrawalParams{
r := UserRequestWithdrawalParams{
Address: withdrawRequest.Crypto.Address,
Amount: withdrawRequest.Amount,
Currency: withdrawRequest.Currency.String(),