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

@@ -7,6 +7,7 @@ import (
"flag"
"net/http"
"net/url"
"slices"
"strings"
"github.com/thrasher-corp/gocryptotrader/common"
@@ -137,7 +138,7 @@ func (s *SMSGlobal) RemoveContact(contact Contact) error {
for x := range s.Contacts {
if s.Contacts[x].Name == contact.Name && s.Contacts[x].Number == contact.Number {
s.Contacts = append(s.Contacts[:x], s.Contacts[x+1:]...)
s.Contacts = slices.Delete(s.Contacts, x, x+1)
return nil
}
}

View File

@@ -274,7 +274,7 @@ func (t *Telegram) SendMessage(text string, chatID int64) error {
}
// SendHTTPRequest sends an authenticated HTTP request
func (t *Telegram) SendHTTPRequest(path string, data []byte, result interface{}) error {
func (t *Telegram) SendHTTPRequest(path string, data []byte, result any) error {
headers := make(map[string]string)
headers["content-type"] = "application/json"

View File

@@ -21,14 +21,14 @@ type GetUpdateResponse struct {
Result []struct {
UpdateID int64 `json:"update_id"`
Message MessageType `json:"message"`
EditedMessage interface{} `json:"edited_message"`
ChannelPost interface{} `json:"channel_post"`
EditedChannelPost interface{} `json:"edited_channel_post"`
InlineQuery interface{} `json:"inline_query"`
ChosenInlineResult interface{} `json:"chosen_inline_result"`
CallbackQuery interface{} `json:"callback_query"`
ShippingQuery interface{} `json:"shipping_query"`
PreCheckoutQuery interface{} `json:"pre_checkout_query"`
EditedMessage any `json:"edited_message"`
ChannelPost any `json:"channel_post"`
EditedChannelPost any `json:"edited_channel_post"`
InlineQuery any `json:"inline_query"`
ChosenInlineResult any `json:"chosen_inline_result"`
CallbackQuery any `json:"callback_query"`
ShippingQuery any `json:"shipping_query"`
PreCheckoutQuery any `json:"pre_checkout_query"`
} `json:"result"`
}
@@ -50,7 +50,7 @@ type MessageType struct {
ForwardFromMessageID int64 `json:"forward_from_message_id"`
ForwardSignature string `json:"forward_signature"`
ForwardDate int64 `json:"forward_date"`
ReplyToMessage interface{} `json:"reply_to_message"`
ReplyToMessage any `json:"reply_to_message"`
EditDate int64 `json:"edit_date"`
MediaGroupID string `json:"media_group_id"`
AuthorSignature string `json:"author_signature"`