mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-17 15:09:59 +00:00
modernise: Run new gopls modernise tool against the codebase and fix minor issues (#1826)
* modernise: Run new gopls modernise tool against codebase
* Address shazbert's nits
* apichecker, gctcli: Simplify HTML scraping functions and improve depth limit handling
* refactor: Create minSyncInterval const and update order book limit handling for binance and binanceUS
* refactor: Various slice usage improvements and rename TODO
* tranches: Revert deleteByID changes due to performance decrease
Shazbert was a F1 driver in a past lifetime 🏎️
* tranches: Simply retrieve copy
Thanks to shazbert
* documentation: Sort contributors list by contributions
* tranches: Remove deadcode in deleteByID
This commit is contained in:
@@ -34,7 +34,7 @@ var (
|
||||
)
|
||||
|
||||
// Setup sets private variables
|
||||
func (w *Orderbook) Setup(exchangeConfig *config.Exchange, c *Config, dataHandler chan<- interface{}) error {
|
||||
func (w *Orderbook) Setup(exchangeConfig *config.Exchange, c *Config, dataHandler chan<- any) error {
|
||||
if exchangeConfig == nil { // exchange config fields are checked in stream package
|
||||
// prior to calling this, so further checks are not needed.
|
||||
return fmt.Errorf(packageError, errExchangeConfigNil)
|
||||
|
||||
@@ -54,8 +54,8 @@ func createSnapshot(pair currency.Pair, bookVerifiy ...bool) (holder *Orderbook,
|
||||
|
||||
newBook := make(map[key.PairAsset]*orderbookHolder)
|
||||
|
||||
ch := make(chan interface{})
|
||||
go func(<-chan interface{}) { // reader
|
||||
ch := make(chan any)
|
||||
go func(<-chan any) { // reader
|
||||
for range ch {
|
||||
continue
|
||||
}
|
||||
@@ -529,7 +529,7 @@ func TestRunSnapshotWithNoData(t *testing.T) {
|
||||
|
||||
var obl Orderbook
|
||||
obl.ob = make(map[key.PairAsset]*orderbookHolder)
|
||||
obl.dataHandler = make(chan interface{}, 1)
|
||||
obl.dataHandler = make(chan any, 1)
|
||||
var snapShot1 orderbook.Base
|
||||
snapShot1.Asset = asset.Spot
|
||||
snapShot1.Pair = cp
|
||||
@@ -546,7 +546,7 @@ func TestLoadSnapshot(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
var obl Orderbook
|
||||
obl.dataHandler = make(chan interface{}, 100)
|
||||
obl.dataHandler = make(chan any, 100)
|
||||
obl.ob = make(map[key.PairAsset]*orderbookHolder)
|
||||
var snapShot1 orderbook.Base
|
||||
snapShot1.Exchange = "SnapshotWithOverride"
|
||||
@@ -581,7 +581,7 @@ func TestInsertingSnapShots(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
var holder Orderbook
|
||||
holder.dataHandler = make(chan interface{}, 100)
|
||||
holder.dataHandler = make(chan any, 100)
|
||||
holder.ob = make(map[key.PairAsset]*orderbookHolder)
|
||||
var snapShot1 orderbook.Base
|
||||
snapShot1.Exchange = "WSORDERBOOKTEST1"
|
||||
@@ -762,7 +762,7 @@ func TestSetup(t *testing.T) {
|
||||
require.ErrorIs(t, err, errUnsetDataHandler)
|
||||
|
||||
exchangeConfig.Orderbook.WebsocketBufferEnabled = true
|
||||
err = w.Setup(exchangeConfig, bufferConf, make(chan interface{}))
|
||||
err = w.Setup(exchangeConfig, bufferConf, make(chan any))
|
||||
require.ErrorIs(t, err, errIssueBufferEnabledButNoLimit)
|
||||
|
||||
exchangeConfig.Orderbook.WebsocketBufferLimit = 1337
|
||||
@@ -771,7 +771,7 @@ func TestSetup(t *testing.T) {
|
||||
bufferConf.SortBuffer = true
|
||||
bufferConf.SortBufferByUpdateIDs = true
|
||||
bufferConf.UpdateEntriesByID = true
|
||||
err = w.Setup(exchangeConfig, bufferConf, make(chan interface{}))
|
||||
err = w.Setup(exchangeConfig, bufferConf, make(chan any))
|
||||
require.NoError(t, err)
|
||||
|
||||
if w.obBufferLimit != 1337 ||
|
||||
@@ -963,7 +963,7 @@ func TestFlushOrderbook(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
w := &Orderbook{}
|
||||
err = w.Setup(&config.Exchange{Name: "test"}, &Config{}, make(chan interface{}, 2))
|
||||
err = w.Setup(&config.Exchange{Name: "test"}, &Config{}, make(chan any, 2))
|
||||
require.NoError(t, err)
|
||||
|
||||
var snapShot1 orderbook.Base
|
||||
|
||||
@@ -35,7 +35,7 @@ type Orderbook struct {
|
||||
sortBufferByUpdateIDs bool // When timestamps aren't provided, an id can help sort
|
||||
updateEntriesByID bool // Use the update IDs to match ob entries
|
||||
exchangeName string
|
||||
dataHandler chan<- interface{}
|
||||
dataHandler chan<- any
|
||||
verbose bool
|
||||
|
||||
// updateIDProgression requires that the new update ID be greater than the
|
||||
|
||||
Reference in New Issue
Block a user