refactor: modernize codebase for Go 1.26 and fix adapter issues
- Upgrade Go version from 1.24 to 1.26.1 with updated dependencies
- Replace interface{} with any type throughout codebase
- Add message deduplication in OneBot11 adapter to prevent duplicate event processing
- URL-encode access token in WebSocket connections to handle special characters
- Remove duplicate bot startup hooks in DI providers (now handled by botManager.StartAll)
- Use slices.Clone and errgroup.Go patterns for cleaner concurrent code
- Apply omitzero JSON tags for optional fields (Go 1.24+ feature)
This commit is contained in:
@@ -47,7 +47,7 @@ func NewAPIClient(baseURL, accessToken string, timeout time.Duration, retryCount
|
||||
// endpoint: API 端点名称(如 "send_private_message")
|
||||
// input: 输入参数(会被序列化为 JSON)
|
||||
// 返回: 响应数据和错误
|
||||
func (c *APIClient) Call(ctx context.Context, endpoint string, input interface{}) (*APIResponse, error) {
|
||||
func (c *APIClient) Call(ctx context.Context, endpoint string, input any) (*APIResponse, error) {
|
||||
// 序列化输入参数
|
||||
var inputData []byte
|
||||
var err error
|
||||
@@ -126,7 +126,7 @@ func (c *APIClient) doRequest(ctx context.Context, url string, inputData []byte)
|
||||
// CallWithoutRetry 调用 API(不重试)
|
||||
// 注意:pkg/net.HTTPClient 的通用请求已经内置了重试机制
|
||||
// 这个方法保留是为了向后兼容,但仍然会使用底层的重试机制
|
||||
func (c *APIClient) CallWithoutRetry(ctx context.Context, endpoint string, input interface{}) (*APIResponse, error) {
|
||||
func (c *APIClient) CallWithoutRetry(ctx context.Context, endpoint string, input any) (*APIResponse, error) {
|
||||
return c.Call(ctx, endpoint, input)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user