mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 07:26:45 +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:
@@ -222,7 +222,7 @@ func RegisterHandler(pattern string, mock map[string][]HTTPResponse, mux *http.S
|
||||
}
|
||||
|
||||
// MessageWriteJSON writes JSON to a connection
|
||||
func MessageWriteJSON(w http.ResponseWriter, status int, data interface{}) {
|
||||
func MessageWriteJSON(w http.ResponseWriter, status int, data any) {
|
||||
w.Header().Set(contentType, applicationJSON)
|
||||
w.WriteHeader(status)
|
||||
if data != nil {
|
||||
@@ -252,7 +252,7 @@ func MatchAndGetResponse(mockData []HTTPResponse, requestVals url.Values, isQuer
|
||||
mockVals := url.Values{}
|
||||
var err error
|
||||
if json.Valid([]byte(data)) {
|
||||
something := make(map[string]interface{})
|
||||
something := make(map[string]any)
|
||||
err = json.Unmarshal([]byte(data), &something)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -266,7 +266,7 @@ func MatchAndGetResponse(mockData []HTTPResponse, requestVals url.Values, isQuer
|
||||
mockVals.Add(k, strconv.FormatBool(val))
|
||||
case float64:
|
||||
mockVals.Add(k, strconv.FormatFloat(val, 'f', -1, 64))
|
||||
case map[string]interface{}, []interface{}, nil:
|
||||
case map[string]any, []any, nil:
|
||||
mockVals.Add(k, fmt.Sprintf("%v", val))
|
||||
default:
|
||||
log.Println(reflect.TypeOf(val))
|
||||
|
||||
Reference in New Issue
Block a user