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

@@ -43,7 +43,7 @@ type testRequest struct {
Event string `json:"event"`
RequestID int64 `json:"reqid,omitempty"`
Pairs []string `json:"pair"`
Subscription testRequestData `json:"subscription,omitempty"`
Subscription testRequestData `json:"subscription"`
}
// testRequestData contains details on WS channel
@@ -96,7 +96,7 @@ func TestSetup(t *testing.T) {
err := w.Setup(nil)
assert.ErrorIs(t, err, errWebsocketIsNil)
w = &Websocket{DataHandler: make(chan interface{})}
w = &Websocket{DataHandler: make(chan any)}
err = w.Setup(nil)
assert.ErrorIs(t, err, errWebsocketSetupIsNil)
@@ -1455,7 +1455,7 @@ func TestMonitorFrame(t *testing.T) {
func TestMonitorData(t *testing.T) {
t.Parallel()
ws := Websocket{ShutdownC: make(chan struct{}), DataHandler: make(chan interface{}, 10)}
ws := Websocket{ShutdownC: make(chan struct{}), DataHandler: make(chan any, 10)}
// Handle shutdown signal
close(ws.ShutdownC)
require.True(t, ws.observeData(nil))
@@ -1466,7 +1466,7 @@ func TestMonitorData(t *testing.T) {
require.False(t, ws.observeData(&dropped))
require.Equal(t, 1, dropped)
// Handle reinstate of ToRoutine functionality which will reset dropped counter
ws.ToRoutine = make(chan interface{}, 10)
ws.ToRoutine = make(chan any, 10)
go func() { ws.DataHandler <- nil }()
require.False(t, ws.observeData(&dropped))
require.Empty(t, dropped)
@@ -1500,7 +1500,7 @@ func TestMonitorConnection(t *testing.T) {
require.False(t, ws.observeConnection(timer)) // Connect is intentionally erroring
// Handle error from a connection which will then trigger a reconnect
ws.setState(connectedState)
ws.DataHandler = make(chan interface{}, 1)
ws.DataHandler = make(chan any, 1)
ws.ReadMessageErrors <- errConnectionFault
timer = time.NewTimer(time.Second)
require.False(t, ws.observeConnection(timer))