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

@@ -153,7 +153,7 @@ func (c *COINUT) CancelExistingOrder(ctx context.Context, instrumentID, orderID
OrderID int64 `json:"order_id"`
}
var entry = Request{
entry := Request{
InstrumentID: instrumentID,
OrderID: orderID,
}

View File

@@ -25,8 +25,10 @@ import (
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
)
var c = &COINUT{}
var wsSetupRan bool
var (
c = &COINUT{}
wsSetupRan bool
)
// Please supply your own keys here to do better tests
const (
@@ -122,7 +124,7 @@ func setFeeBuilder() *exchange.FeeBuilder {
// TestGetFeeByTypeOfflineTradeFee logic test
func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
_, err := c.GetFeeByType(context.Background(), feeBuilder)
if err != nil {
t.Fatal(err)
@@ -140,7 +142,7 @@ func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
func TestGetFee(t *testing.T) {
t.Parallel()
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
// CryptocurrencyTradeFee Basic
if _, err := c.GetFee(feeBuilder); err != nil {
t.Error(err)
@@ -250,7 +252,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,
@@ -264,7 +266,7 @@ func TestGetActiveOrders(t *testing.T) {
func TestGetOrderHistoryWrapper(t *testing.T) {
t.Parallel()
setupWSTestAuth(t)
var getOrdersRequest = order.MultiOrderRequest{
getOrdersRequest := order.MultiOrderRequest{
Type: order.AnyType,
AssetType: asset.Spot,
Pairs: []currency.Pair{currency.NewPair(currency.BTC, currency.USD)},
@@ -284,7 +286,7 @@ func TestSubmitOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, c, canManipulateRealOrders)
var orderSubmission = &order.Submit{
orderSubmission := &order.Submit{
Exchange: c.Name,
Pair: currency.Pair{
Base: currency.BTC,
@@ -310,7 +312,7 @@ func TestCancelExchangeOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, c, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.BTC, currency.USD)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -332,7 +334,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, c, canManipulateRealOrders)
currencyPair := currency.NewPair(currency.LTC, currency.BTC)
var orderCancellation = &order.Cancel{
orderCancellation := &order.Cancel{
OrderID: "1",
WalletAddress: core.BitcoinDonationAddress,
AccountID: "1",
@@ -405,7 +407,7 @@ func TestWithdrawFiat(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, c, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := c.WithdrawFiatFunds(context.Background(), &withdrawFiatRequest)
if err != common.ErrFunctionNotSupported {
t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err)
@@ -416,7 +418,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, c, canManipulateRealOrders)
var withdrawFiatRequest = withdraw.Request{}
withdrawFiatRequest := withdraw.Request{}
_, err := c.WithdrawFiatFundsToInternationalBank(context.Background(),
&withdrawFiatRequest)
if err != common.ErrFunctionNotSupported {

View File

@@ -218,7 +218,7 @@ func (c *COINUT) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (a
}
}
var balances = []account.Balance{
balances := []account.Balance{
{
Currency: currency.BCH,
Total: bal.BCH,
@@ -337,7 +337,8 @@ func (c *COINUT) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item
Pair: p,
LastUpdated: time.Unix(0, tick.Timestamp),
ExchangeName: c.Name,
AssetType: a})
AssetType: a,
})
if err != nil {
return nil, err
}