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

@@ -162,7 +162,8 @@ func TestLoadDataAPI(t *testing.T) {
APIData: &config.APIData{
StartDate: time.Now().Truncate(gctkline.OneMin.Duration()).Add(-time.Minute * 5),
EndDate: time.Now().Truncate(gctkline.OneMin.Duration()),
}},
},
},
StrategySettings: config.StrategySettings{
Name: dollarcostaverage.Name,
CustomSettings: map[string]interface{}{
@@ -183,7 +184,8 @@ func TestLoadDataAPI(t *testing.T) {
Enabled: currency.Pairs{cp},
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
RequestFormat: &currency.PairFormat{Uppercase: true},
}
_, err = bt.loadData(cfg, exch, cp, asset.Spot, false)
if err != nil {
@@ -216,7 +218,8 @@ func TestLoadDataCSV(t *testing.T) {
Interval: gctkline.OneMin,
CSVData: &config.CSVData{
FullPath: "test",
}},
},
},
StrategySettings: config.StrategySettings{
Name: dollarcostaverage.Name,
CustomSettings: map[string]interface{}{
@@ -237,7 +240,8 @@ func TestLoadDataCSV(t *testing.T) {
Enabled: currency.Pairs{cp},
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
RequestFormat: &currency.PairFormat{Uppercase: true},
}
_, err = bt.loadData(cfg, exch, cp, asset.Spot, false)
if err != nil &&
!strings.Contains(err.Error(), "The system cannot find the file specified.") &&
@@ -281,7 +285,8 @@ func TestLoadDataDatabase(t *testing.T) {
StartDate: time.Now().Add(-time.Minute),
EndDate: time.Now(),
InclusiveEndDate: true,
}},
},
},
StrategySettings: config.StrategySettings{
Name: dollarcostaverage.Name,
CustomSettings: map[string]interface{}{
@@ -302,7 +307,8 @@ func TestLoadDataDatabase(t *testing.T) {
Enabled: currency.Pairs{cp},
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
RequestFormat: &currency.PairFormat{Uppercase: true},
}
bt.databaseManager, err = engine.SetupDatabaseConnectionManager(&cfg.DataSettings.DatabaseData.Config)
if err != nil {
t.Fatal(err)
@@ -357,7 +363,8 @@ func TestLoadDataLive(t *testing.T) {
},
},
RealOrders: true,
}},
},
},
StrategySettings: config.StrategySettings{
Name: dollarcostaverage.Name,
CustomSettings: map[string]interface{}{
@@ -385,7 +392,8 @@ func TestLoadDataLive(t *testing.T) {
Enabled: currency.Pairs{cp},
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
RequestFormat: &currency.PairFormat{Uppercase: true},
}
_, err = bt.loadData(cfg, exch, cp, asset.Spot, false)
if !errors.Is(err, gctkline.ErrCannotConstructInterval) {
t.Errorf("received: %v, expected: %v", err, gctkline.ErrCannotConstructInterval)
@@ -717,9 +725,11 @@ func TestTriggerLiquidationsForExchange(t *testing.T) {
a := asset.USDTMarginedFutures
expectedError = gctcommon.ErrNilPointer
ev := &evkline.Kline{
Base: &event.Base{Exchange: testExchange,
Base: &event.Base{
Exchange: testExchange,
AssetType: a,
CurrencyPair: cp},
CurrencyPair: cp,
},
}
err = bt.triggerLiquidationsForExchange(ev, nil)
if !errors.Is(err, expectedError) {
@@ -885,9 +895,11 @@ func TestProcessSignalEvent(t *testing.T) {
cp := currency.NewPair(currency.BTC, currency.USDT)
a := asset.USDTMarginedFutures
de := &evkline.Kline{
Base: &event.Base{Exchange: testExchange,
Base: &event.Base{
Exchange: testExchange,
AssetType: a,
CurrencyPair: cp},
CurrencyPair: cp,
},
}
err := bt.Statistic.SetEventForOffset(de)
if !errors.Is(err, expectedError) {
@@ -951,9 +963,11 @@ func TestProcessOrderEvent(t *testing.T) {
cp := currency.NewPair(currency.BTC, currency.USDT)
a := asset.USDTMarginedFutures
de := &evkline.Kline{
Base: &event.Base{Exchange: testExchange,
Base: &event.Base{
Exchange: testExchange,
AssetType: a,
CurrencyPair: cp},
CurrencyPair: cp,
},
}
err = bt.Statistic.SetEventForOffset(de)
if !errors.Is(err, expectedError) {
@@ -1186,7 +1200,8 @@ func TestProcessFuturesFillEvent(t *testing.T) {
Base: &event.Base{
Exchange: testExchange,
AssetType: a,
CurrencyPair: cp},
CurrencyPair: cp,
},
}
err := bt.Statistic.SetEventForOffset(de)
if !errors.Is(err, expectedError) {