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

@@ -359,7 +359,6 @@ func (h *HitBTC) CancelExistingOrder(ctx context.Context, orderID int64) (bool,
values,
tradingRequests,
&result)
if err != nil {
return false, err
}
@@ -396,7 +395,6 @@ func (h *HitBTC) Withdraw(ctx context.Context, currency, address string, amount
values,
otherRequests,
&result)
if err != nil {
return false, err
}
@@ -481,7 +479,6 @@ func (h *HitBTC) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (f
feeBuilder.Pair.Base.String()+
feeBuilder.Pair.Delimiter+
feeBuilder.Pair.Quote.String())
if err != nil {
return 0, err
}

View File

@@ -139,7 +139,7 @@ func setFeeBuilder() *exchange.FeeBuilder {
// TestGetFeeByTypeOfflineTradeFee logic test
func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
_, err := h.GetFeeByType(context.Background(), feeBuilder)
if err != nil {
t.Fatal(err)
@@ -198,7 +198,7 @@ func TestGetSingularTicker(t *testing.T) {
}
func TestGetFee(t *testing.T) {
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
if sharedtestvalues.AreAPICredentialsSet(h) {
// CryptocurrencyTradeFee Basic
if _, err := h.GetFee(context.Background(), feeBuilder); err != nil {
@@ -274,7 +274,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
func TestGetActiveOrders(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
Type: order.AnyType,
Pairs: []currency.Pair{currency.NewPair(currency.ETH, currency.BTC)},
AssetType: asset.Spot,
@@ -291,7 +291,7 @@ func TestGetActiveOrders(t *testing.T) {
func TestGetOrderHistory(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
Type: order.AnyType,
AssetType: asset.Spot,
Pairs: []currency.Pair{currency.NewPair(currency.ETH, currency.BTC)},
@@ -312,7 +312,7 @@ func TestSubmitOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, h, canManipulateRealOrders)
var orderSubmission = &order.Submit{
orderSubmission := &order.Submit{
Exchange: h.Name,
Pair: currency.Pair{
Base: currency.DGD,
@@ -338,7 +338,7 @@ func TestCancelExchangeOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, h, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -360,7 +360,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, h, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -421,7 +421,7 @@ func TestWithdrawFiat(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, h, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := h.WithdrawFiatFunds(context.Background(), &withdrawFiatRequest)
if err != common.ErrFunctionNotSupported {
t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err)
@@ -432,7 +432,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, h, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := h.WithdrawFiatFundsToInternationalBank(context.Background(),
&withdrawFiatRequest)
if err != common.ErrFunctionNotSupported {

View File

@@ -98,7 +98,6 @@ type Balance struct {
Currency string `json:"currency"`
Available float64 `json:"available,string"` // Amount available for trading or transfer to main account
Reserved float64 `json:"reserved,string"` // Amount reserved for active orders or incomplete transfers to main account
}
// DepositCryptoAddresses contains address information

View File

@@ -243,7 +243,8 @@ func (h *HitBTC) UpdateTickers(ctx context.Context, a asset.Item) error {
Pair: pair,
LastUpdated: tick[x].Timestamp,
ExchangeName: h.Name,
AssetType: a})
AssetType: a,
})
if err != nil {
return err
}
@@ -520,10 +521,9 @@ func (h *HitBTC) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Ca
for i := range resp {
if resp[i].Status != "canceled" {
cancelAllOrdersResponse.Status[strconv.FormatInt(resp[i].ID, 10)] =
fmt.Sprintf("Could not cancel order %v. Status: %v",
resp[i].ID,
resp[i].Status)
cancelAllOrdersResponse.Status[strconv.FormatInt(resp[i].ID, 10)] = fmt.Sprintf("Could not cancel order %v. Status: %v",
resp[i].ID,
resp[i].Status)
}
}