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

@@ -356,7 +356,7 @@ func (b *Bitstamp) GetOrderStatus(ctx context.Context, orderID int64) (OrderStat
// CancelExistingOrder cancels order by ID
func (b *Bitstamp) CancelExistingOrder(ctx context.Context, orderID int64) (CancelOrder, error) {
var req = url.Values{}
req := url.Values{}
req.Add("id", strconv.FormatInt(orderID, 10))
var result CancelOrder
@@ -378,7 +378,7 @@ func (b *Bitstamp) CancelAllExistingOrders(ctx context.Context) (bool, error) {
// PlaceOrder places an order on the exchange.
func (b *Bitstamp) PlaceOrder(ctx context.Context, currencyPair string, price, amount float64, buy, market bool) (Order, error) {
var req = url.Values{}
req := url.Values{}
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
req.Add("price", strconv.FormatFloat(price, 'f', -1, 64))
response := Order{}
@@ -425,7 +425,7 @@ func (b *Bitstamp) GetWithdrawalRequests(ctx context.Context, timedelta int64) (
// symbol - the type of crypto ie "ltc", "btc", "eth"
// destTag - only for XRP default to ""
func (b *Bitstamp) CryptoWithdrawal(ctx context.Context, amount float64, address, symbol, destTag string) (*CryptoWithdrawalResponse, error) {
var req = url.Values{}
req := url.Values{}
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
req.Add("address", address)
@@ -449,8 +449,9 @@ func (b *Bitstamp) CryptoWithdrawal(ctx context.Context, amount float64, address
// OpenBankWithdrawal Opens a bank withdrawal request (SEPA or international)
func (b *Bitstamp) OpenBankWithdrawal(ctx context.Context, amount float64, currency,
name, iban, bic, address, postalCode, city, country,
comment, withdrawalType string) (FIATWithdrawalResponse, error) {
var req = url.Values{}
comment, withdrawalType string,
) (FIATWithdrawalResponse, error) {
req := url.Values{}
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
req.Add("account_currency", currency)
req.Add("name", name)
@@ -471,8 +472,9 @@ func (b *Bitstamp) OpenBankWithdrawal(ctx context.Context, amount float64, curre
func (b *Bitstamp) OpenInternationalBankWithdrawal(ctx context.Context, amount float64, currency,
name, iban, bic, address, postalCode, city, country,
bankName, bankAddress, bankPostCode, bankCity, bankCountry, internationalCurrency,
comment, withdrawalType string) (FIATWithdrawalResponse, error) {
var req = url.Values{}
comment, withdrawalType string,
) (FIATWithdrawalResponse, error) {
req := url.Values{}
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
req.Add("account_currency", currency)
req.Add("name", name)
@@ -513,7 +515,7 @@ func (b *Bitstamp) GetUnconfirmedBitcoinDeposits(ctx context.Context) ([]Unconfi
// OHLC returns OHLCV data for step (interval)
func (b *Bitstamp) OHLC(ctx context.Context, currency string, start, end time.Time, step, limit string) (resp OHLCResponse, err error) {
var v = url.Values{}
v := url.Values{}
v.Add("limit", limit)
v.Add("step", step)
@@ -535,7 +537,7 @@ func (b *Bitstamp) OHLC(ctx context.Context, currency string, start, end time.Ti
// subaccount - name of account
// toMain - bool either to or from account
func (b *Bitstamp) TransferAccountBalance(ctx context.Context, amount float64, currency, subAccount string, toMain bool) error {
var req = url.Values{}
req := url.Values{}
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
req.Add("currency", currency)

View File

@@ -31,8 +31,10 @@ const (
canManipulateRealOrders = false
)
var b = &Bitstamp{}
var btcusdPair = currency.NewPair(currency.BTC, currency.USD)
var (
b = &Bitstamp{}
btcusdPair = currency.NewPair(currency.BTC, currency.USD)
)
func setFeeBuilder() *exchange.FeeBuilder {
return &exchange.FeeBuilder{
@@ -50,7 +52,7 @@ func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
if !mockTests {
sharedtestvalues.SkipTestIfCredentialsUnset(t, b)
}
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
_, err := b.GetFeeByType(context.Background(), feeBuilder)
require.NoError(t, err, "GetFeeByType must not error")
if mockTests {
@@ -63,7 +65,7 @@ func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
func TestGetFee(t *testing.T) {
t.Parallel()
var feeBuilder = setFeeBuilder()
feeBuilder := setFeeBuilder()
// CryptocurrencyTradeFee Basic
if !mockTests {
@@ -616,7 +618,7 @@ func TestWithdrawFiat(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, b, canManipulateRealOrders)
}
var withdrawFiatRequest = withdraw.Request{
withdrawFiatRequest := withdraw.Request{
Type: withdraw.Fiat,
Exchange: b.Name,
Fiat: withdraw.FiatRequest{
@@ -659,7 +661,7 @@ func TestWithdrawInternationalBank(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, b, canManipulateRealOrders)
}
var withdrawFiatRequest = withdraw.Request{
withdrawFiatRequest := withdraw.Request{
Type: withdraw.Fiat,
Exchange: b.Name,
Fiat: withdraw.FiatRequest{

View File

@@ -266,7 +266,8 @@ func (b *Bitstamp) UpdateTicker(ctx context.Context, p currency.Pair, a asset.It
Pair: fPair,
LastUpdated: time.Unix(tick.Timestamp, 0),
ExchangeName: b.Name,
AssetType: a})
AssetType: a,
})
if err != nil {
return nil, err
}