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:
@@ -260,14 +260,14 @@ func (m *MetricsMiddleware) Process(ctx context.Context, event protocol.Event, n
|
||||
}
|
||||
|
||||
// GetMetrics 获取指标
|
||||
func (m *MetricsMiddleware) GetMetrics() map[string]interface{} {
|
||||
func (m *MetricsMiddleware) GetMetrics() map[string]any {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
|
||||
metrics := make(map[string]interface{})
|
||||
metrics := make(map[string]any)
|
||||
for eventType, count := range m.eventCounts {
|
||||
avgTime := m.eventTimes[eventType] / time.Duration(count)
|
||||
metrics[eventType] = map[string]interface{}{
|
||||
metrics[eventType] = map[string]any{
|
||||
"count": count,
|
||||
"avg_time": avgTime.String(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user