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:
Adrian Gallagher
2025-03-21 09:17:10 +11:00
committed by GitHub
parent d857d704e3
commit 4651af5767
223 changed files with 1504 additions and 1752 deletions

View File

@@ -6,7 +6,7 @@ import "errors"
var ErrFeedDisabled = errors.New("fill feed disabled")
// Setup sets up the fill processor
func (f *Fills) Setup(fillsFeedEnabled bool, c chan interface{}) {
func (f *Fills) Setup(fillsFeedEnabled bool, c chan any) {
f.dataHandler = c
f.fillsFeedEnabled = fillsFeedEnabled
}

View File

@@ -9,7 +9,7 @@ import (
// TestSetup tests the setup function of the Fills struct
func TestSetup(t *testing.T) {
fill := &Fills{}
channel := make(chan interface{})
channel := make(chan any)
fill.Setup(true, channel)
if fill.dataHandler == nil {
@@ -23,7 +23,7 @@ func TestSetup(t *testing.T) {
// TestUpdateDisabledFeed tests the Update function when fillsFeedEnabled is false
func TestUpdateDisabledFeed(t *testing.T) {
channel := make(chan interface{}, 1)
channel := make(chan any, 1)
fill := Fills{dataHandler: channel, fillsFeedEnabled: false}
// Send a test data to the Update function
@@ -42,7 +42,7 @@ func TestUpdateDisabledFeed(t *testing.T) {
// TestUpdate tests the Update function of the Fills struct.
func TestUpdate(t *testing.T) {
channel := make(chan interface{}, 1)
channel := make(chan any, 1)
fill := &Fills{dataHandler: channel, fillsFeedEnabled: true}
receivedData := Data{Timestamp: time.Now(), Price: 15.2, Amount: 3.2}
if err := fill.Update(receivedData); err != nil {
@@ -66,7 +66,7 @@ func TestUpdate(t *testing.T) {
// TestUpdateNoData tests the Update function with no Data objects
func TestUpdateNoData(t *testing.T) {
channel := make(chan interface{}, 1)
channel := make(chan any, 1)
fill := &Fills{dataHandler: channel, fillsFeedEnabled: true}
if err := fill.Update(); err != nil {
t.Errorf("Update returned error %v", err)
@@ -82,7 +82,7 @@ func TestUpdateNoData(t *testing.T) {
// TestUpdateMultipleData tests the Update function with multiple Data objects
func TestUpdateMultipleData(t *testing.T) {
channel := make(chan interface{}, 2)
channel := make(chan any, 2)
fill := &Fills{dataHandler: channel, fillsFeedEnabled: true}
receivedData := Data{Timestamp: time.Now(), Price: 15.2, Amount: 3.2}
receivedData2 := Data{Timestamp: time.Now(), Price: 18.2, Amount: 9.0}

View File

@@ -10,7 +10,7 @@ import (
// Fills is used to hold data and methods related to fill dissemination
type Fills struct {
dataHandler chan interface{}
dataHandler chan any
fillsFeedEnabled bool
}