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:
parent
d25abb59a4
commit
d3de49f3a3
5 changed files with 1153 additions and 46 deletions
1
.worktrees/qq-stability
Submodule
1
.worktrees/qq-stability
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 75ba9e83883d143fff60d511885e2b14b9cab597
|
||||||
1104
docs/superpowers/plans/2026-03-19-qq-stability-improvements.md
Normal file
1104
docs/superpowers/plans/2026-03-19-qq-stability-improvements.md
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1093,15 +1093,15 @@ func (c *QQChannel) reconnect() {
|
||||||
// resetSessionState clears transient state that may be invalid after reconnection.
|
// resetSessionState clears transient state that may be invalid after reconnection.
|
||||||
func (c *QQChannel) resetSessionState() {
|
func (c *QQChannel) resetSessionState() {
|
||||||
// Clear transient state that may be invalid after reconnection
|
// 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)
|
c.chatType.Delete(key)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
c.lastMsgID.Range(func(key, value interface{}) bool {
|
c.lastMsgID.Range(func(key, value any) bool {
|
||||||
c.lastMsgID.Delete(key)
|
c.lastMsgID.Delete(key)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
c.msgSeqCounters.Range(func(key, value interface{}) bool {
|
c.msgSeqCounters.Range(func(key, value any) bool {
|
||||||
c.msgSeqCounters.Delete(key)
|
c.msgSeqCounters.Delete(key)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ func (m *mockQQAPI) WS(ctx context.Context, params map[string]string, body strin
|
||||||
}, nil
|
}, 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.postCalled.Store(true)
|
||||||
m.lastChatID = groupID
|
m.lastChatID = groupID
|
||||||
m.lastChatKind = "group"
|
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
|
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.postCalled.Store(true)
|
||||||
m.lastChatID = userID
|
m.lastChatID = userID
|
||||||
m.lastChatKind = "direct"
|
m.lastChatKind = "direct"
|
||||||
|
|
@ -102,7 +106,6 @@ func TestSend_Success(t *testing.T) {
|
||||||
ChatID: "group-1",
|
ChatID: "group-1",
|
||||||
Content: "Hello",
|
Content: "Hello",
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected no error, got %v", err)
|
t.Errorf("expected no error, got %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +130,6 @@ func TestSend_WithRetry(t *testing.T) {
|
||||||
ChatID: "group-1",
|
ChatID: "group-1",
|
||||||
Content: "Hello",
|
Content: "Hello",
|
||||||
})
|
})
|
||||||
|
|
||||||
// Should succeed after retries
|
// Should succeed after retries
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected success after retry, got %v", err)
|
t.Errorf("expected success after retry, got %v", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue