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

@@ -11,7 +11,7 @@ import (
)
// FloatFromString format
func FloatFromString(raw interface{}) (float64, error) {
func FloatFromString(raw any) (float64, error) {
str, ok := raw.(string)
if !ok {
return 0, fmt.Errorf("unable to parse, value not string: %T", raw)
@@ -24,7 +24,7 @@ func FloatFromString(raw interface{}) (float64, error) {
}
// IntFromString format
func IntFromString(raw interface{}) (int, error) {
func IntFromString(raw any) (int, error) {
str, ok := raw.(string)
if !ok {
return 0, fmt.Errorf("unable to parse, value not string: %T", raw)
@@ -37,7 +37,7 @@ func IntFromString(raw interface{}) (int, error) {
}
// Int64FromString format
func Int64FromString(raw interface{}) (int64, error) {
func Int64FromString(raw any) (int64, error) {
str, ok := raw.(string)
if !ok {
return 0, fmt.Errorf("unable to parse, value not string: %T", raw)
@@ -50,7 +50,7 @@ func Int64FromString(raw interface{}) (int64, error) {
}
// TimeFromUnixTimestampFloat format
func TimeFromUnixTimestampFloat(raw interface{}) (time.Time, error) {
func TimeFromUnixTimestampFloat(raw any) (time.Time, error) {
ts, ok := raw.(float64)
if !ok {
return time.Time{}, fmt.Errorf("unable to parse, value not float64: %T", raw)
@@ -167,7 +167,7 @@ func numberToHumanFriendlyString(str string, dec uint, decPoint, thousandsSep st
}
// InterfaceToFloat64OrZeroValue returns the type assertion value or variable zero value
func InterfaceToFloat64OrZeroValue(r interface{}) float64 {
func InterfaceToFloat64OrZeroValue(r any) float64 {
if v, ok := r.(float64); ok {
return v
}
@@ -175,7 +175,7 @@ func InterfaceToFloat64OrZeroValue(r interface{}) float64 {
}
// InterfaceToIntOrZeroValue returns the type assertion value or variable zero value
func InterfaceToIntOrZeroValue(r interface{}) int {
func InterfaceToIntOrZeroValue(r any) int {
if v, ok := r.(int); ok {
return v
}
@@ -183,7 +183,7 @@ func InterfaceToIntOrZeroValue(r interface{}) int {
}
// InterfaceToStringOrZeroValue returns the type assertion value or variable zero value
func InterfaceToStringOrZeroValue(r interface{}) string {
func InterfaceToStringOrZeroValue(r any) string {
if v, ok := r.(string); ok {
return v
}

View File

@@ -196,7 +196,7 @@ func TestNumberToHumanFriendlyString(t *testing.T) {
}
func TestInterfaceToFloat64OrZeroValue(t *testing.T) {
var x interface{}
var x any
if r := InterfaceToFloat64OrZeroValue(x); r != 0 {
t.Errorf("expected 0, got: %v", r)
}
@@ -207,7 +207,7 @@ func TestInterfaceToFloat64OrZeroValue(t *testing.T) {
}
func TestInterfaceToIntOrZeroValue(t *testing.T) {
var x interface{}
var x any
if r := InterfaceToIntOrZeroValue(x); r != 0 {
t.Errorf("expected 0, got: %v", r)
}
@@ -218,7 +218,7 @@ func TestInterfaceToIntOrZeroValue(t *testing.T) {
}
func TestInterfaceToStringOrZeroValue(t *testing.T) {
var x interface{}
var x any
if r := InterfaceToStringOrZeroValue(x); r != "" {
t.Errorf("expected empty string, got: %v", r)
}