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

@@ -251,7 +251,6 @@ func (h *HUOBI) GetTrades(ctx context.Context, symbol currency.Pair) ([]Trade, e
// symbol: string of currency pair
func (h *HUOBI) GetLatestSpotPrice(ctx context.Context, symbol currency.Pair) (float64, error) {
list, err := h.GetTradeHistory(ctx, symbol, 1)
if err != nil {
return 0, err
}

View File

@@ -1077,7 +1077,7 @@ func setFeeBuilder() *exchange.FeeBuilder {
// TestGetFeeByTypeOfflineTradeFee logic test
func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
_, err := h.GetFeeByType(context.Background(), feeBuilder)
require.NoError(t, err)
if !sharedtestvalues.AreAPICredentialsSet(h) {
@@ -1089,7 +1089,7 @@ func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
func TestGetFee(t *testing.T) {
t.Parallel()
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
// CryptocurrencyTradeFee Basic
_, err := h.GetFee(feeBuilder)
require.NoError(t, err)
@@ -1155,7 +1155,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
func TestGetActiveOrders(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
AssetType: asset.Spot,
Type: order.AnyType,
Pairs: []currency.Pair{currency.NewPair(currency.BTC, currency.USDT)},
@@ -1178,7 +1178,7 @@ func TestSubmitOrder(t *testing.T) {
accounts, err := h.GetAccounts(context.Background())
require.NoError(t, err, "GetAccounts must not error")
var orderSubmission = &order.Submit{
orderSubmission := &order.Submit{
Exchange: h.Name,
Pair: currency.Pair{
Base: currency.BTC,
@@ -1199,7 +1199,7 @@ func TestSubmitOrder(t *testing.T) {
func TestCancelExchangeOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCredentialsUnset(t, h, canManipulateRealOrders)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -1215,7 +1215,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCredentialsUnset(t, h, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = order.Cancel{
orderCancellation := order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -2074,8 +2074,10 @@ func TestBootstrap(t *testing.T) {
require.NotNil(t, h.futureContractCodes)
}
var updatePairsMutex sync.Mutex
var futureContractCodesCache map[string]currency.Code
var (
updatePairsMutex sync.Mutex
futureContractCodesCache map[string]currency.Code
)
// updatePairsOnce updates the pairs once, and ensures a future dated contract is enabled
func updatePairsOnce(tb testing.TB, h *HUOBI) {

View File

@@ -962,7 +962,7 @@ func (h *HUOBI) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submit
return nil, err
}
var formattedType SpotNewOrderRequestParamsType
var params = SpotNewOrderRequestParams{
params := SpotNewOrderRequestParams{
Amount: s.Amount,
Source: "api",
Symbol: s.Pair,
@@ -1261,7 +1261,7 @@ func (h *HUOBI) GetOrderInfo(ctx context.Context, orderID string, pair currency.
if respData.ID == 0 {
return nil, fmt.Errorf("%s - order not found for orderid %s", h.Name, orderID)
}
var responseID = strconv.FormatInt(respData.ID, 10)
responseID := strconv.FormatInt(respData.ID, 10)
if responseID != orderID {
return nil, errors.New(h.Name + " - GetOrderInfo orderID mismatch. Expected: " +
orderID + " Received: " + responseID)