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

@@ -789,7 +789,7 @@ type PlaceOrderRequestParam struct {
QuantityType string `json:"tgtCcy,omitempty"` // values base_ccy and quote_ccy
// Added in the websocket requests
BanAmend bool `json:"banAmend,omitempty"` // Whether the SPOT Market Order size can be amended by the system.
ExpiryTime types.Time `json:"expTime,omitempty"`
ExpiryTime types.Time `json:"expTime,omitzero"`
}
// OrderData response message for place, cancel, and amend an order requests.
@@ -1570,8 +1570,8 @@ type ConvertCurrencyPair struct {
// EstimateQuoteRequestInput represents estimate quote request parameters
type EstimateQuoteRequestInput struct {
BaseCurrency currency.Code `json:"baseCcy,omitempty"`
QuoteCurrency currency.Code `json:"quoteCcy,omitempty"`
BaseCurrency currency.Code `json:"baseCcy,omitzero"`
QuoteCurrency currency.Code `json:"quoteCcy,omitzero"`
Side string `json:"side,omitempty"`
RFQAmount float64 `json:"rfqSz,omitempty"`
RFQSzCurrency string `json:"rfqSzCcy,omitempty"`
@@ -1954,7 +1954,7 @@ type SetLeverageInput struct {
Leverage float64 `json:"lever,string"` // set leverage for isolated
MarginMode string `json:"mgnMode"` // Margin Mode "cross" and "isolated"
InstrumentID string `json:"instId,omitempty"` // Optional:
Currency currency.Code `json:"ccy,omitempty"` // Optional:
Currency currency.Code `json:"ccy,omitzero"` // Optional:
PositionSide string `json:"posSide,omitempty"`
AssetType asset.Item `json:"-"`
@@ -2153,10 +2153,10 @@ type MaximumWithdrawal struct {
// AccountRiskState represents account risk state
type AccountRiskState struct {
IsTheAccountAtRisk string `json:"atRisk"`
AtRiskIdx []interface{} `json:"atRiskIdx"` // derivatives risk unit list
AtRiskMgn []interface{} `json:"atRiskMgn"` // margin risk unit list
Timestamp types.Time `json:"ts"`
IsTheAccountAtRisk string `json:"atRisk"`
AtRiskIdx []any `json:"atRiskIdx"` // derivatives risk unit list
AtRiskMgn []any `json:"atRiskMgn"` // margin risk unit list
Timestamp types.Time `json:"ts"`
}
// LoanBorrowAndReplayInput represents currency VIP borrow or repay request params
@@ -3138,15 +3138,15 @@ type wsRequestInfo struct {
}
type wsIncomingData struct {
Event string `json:"event,omitempty"`
Argument SubscriptionInfo `json:"arg,omitempty"`
StatusCode string `json:"code,omitempty"`
Message string `json:"msg,omitempty"`
Event string `json:"event"`
Argument SubscriptionInfo `json:"arg"`
StatusCode string `json:"code"`
Message string `json:"msg"`
// For Websocket Trading Endpoints websocket responses
ID string `json:"id,omitempty"`
Operation string `json:"op,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
ID string `json:"id"`
Operation string `json:"op"`
Data json.RawMessage `json:"data"`
}
// copyToPlaceOrderResponse returns WSPlaceOrderResponse struct instance
@@ -3169,7 +3169,7 @@ func (w *wsIncomingData) copyToPlaceOrderResponse() (*WsPlaceOrderResponse, erro
}
// copyResponseToInterface unmarshals the response data into the dataHolder interface.
func (w *wsIncomingData) copyResponseToInterface(dataHolder interface{}) error {
func (w *wsIncomingData) copyResponseToInterface(dataHolder any) error {
rv := reflect.ValueOf(dataHolder)
if rv.Kind() != reflect.Pointer {
return errInvalidResponseParam

View File

@@ -1519,7 +1519,7 @@ func (ok *Okx) wsProcessBlockPublicTrades(data []byte) error {
}
// wsProcessPushData processes push data coming through the websocket channel
func (ok *Okx) wsProcessPushData(data []byte, resp interface{}) error {
func (ok *Okx) wsProcessPushData(data []byte, resp any) error {
if err := json.Unmarshal(data, resp); err != nil {
return err
}