fix(qq): resolve golangci-lint formatting issues

- Fix interface{} → any in sync.Map Range callbacks
- Wrap long method signatures in mockQQAPI
- Remove blank lines between }) and following statements per gofumpt
This commit is contained in:
kent.liu 2026-03-19 18:18:44 +08:00
parent d25abb59a4
commit d3de49f3a3
5 changed files with 1153 additions and 46 deletions

@ -0,0 +1 @@
Subproject commit 75ba9e83883d143fff60d511885e2b14b9cab597

File diff suppressed because it is too large Load diff

View file

@ -1093,15 +1093,15 @@ func (c *QQChannel) reconnect() {
// resetSessionState clears transient state that may be invalid after reconnection.
func (c *QQChannel) resetSessionState() {
// Clear transient state that may be invalid after reconnection
c.chatType.Range(func(key, value interface{}) bool {
c.chatType.Range(func(key, value any) bool {
c.chatType.Delete(key)
return true
})
c.lastMsgID.Range(func(key, value interface{}) bool {
c.lastMsgID.Range(func(key, value any) bool {
c.lastMsgID.Delete(key)
return true
})
c.msgSeqCounters.Range(func(key, value interface{}) bool {
c.msgSeqCounters.Range(func(key, value any) bool {
c.msgSeqCounters.Delete(key)
return true
})

View file

@ -35,7 +35,9 @@ func (m *mockQQAPI) WS(ctx context.Context, params map[string]string, body strin
}, nil
}
func (m *mockQQAPI) PostGroupMessage(ctx context.Context, groupID string, msg dto.APIMessage, opt ...options.Option) (*dto.Message, error) {
func (m *mockQQAPI) PostGroupMessage(
ctx context.Context, groupID string, msg dto.APIMessage, opt ...options.Option,
) (*dto.Message, error) {
m.postCalled.Store(true)
m.lastChatID = groupID
m.lastChatKind = "group"
@ -51,7 +53,9 @@ func (m *mockQQAPI) PostGroupMessage(ctx context.Context, groupID string, msg dt
return &dto.Message{ID: "msg-123"}, nil
}
func (m *mockQQAPI) PostC2CMessage(ctx context.Context, userID string, msg dto.APIMessage, opt ...options.Option) (*dto.Message, error) {
func (m *mockQQAPI) PostC2CMessage(
ctx context.Context, userID string, msg dto.APIMessage, opt ...options.Option,
) (*dto.Message, error) {
m.postCalled.Store(true)
m.lastChatID = userID
m.lastChatKind = "direct"
@ -102,7 +106,6 @@ func TestSend_Success(t *testing.T) {
ChatID: "group-1",
Content: "Hello",
})
if err != nil {
t.Errorf("expected no error, got %v", err)
}
@ -127,7 +130,6 @@ func TestSend_WithRetry(t *testing.T) {
ChatID: "group-1",
Content: "Hello",
})
// Should succeed after retries
if err != nil {
t.Errorf("expected success after retry, got %v", err)