fix(linter): fix ci lint err

This commit is contained in:
Hoshina
2026-03-24 16:34:21 +08:00
parent c3631d84ba
commit 11b6b10d59
3 changed files with 17 additions and 12 deletions
+8 -4
View File
@@ -216,7 +216,10 @@ func detectWeComFiletype(data []byte) (string, string) {
return normalizeWeComContentType(kind.MIME.Value), ext
}
func detectWeComMediaMetadata(data []byte, fallbackName, fallbackContentType, resourceURL, contentDisposition string) (string, string) {
func detectWeComMediaMetadata(
data []byte,
fallbackName, fallbackContentType, resourceURL, contentDisposition string,
) (string, string) {
filename := candidateWeComFilename(resourceURL, contentDisposition, fallbackName)
if filename == "" {
filename = "media"
@@ -717,7 +720,7 @@ func (c *WeComChannel) uploadOutboundMedia(
if end > len(data) {
end = len(data)
}
if err := c.sendCommand(wecomCommand{
sendErr := c.sendCommand(wecomCommand{
Cmd: wecomCmdUploadMediaChunk,
Headers: wecomHeaders{ReqID: randomID(10)},
Body: wecomUploadMediaChunkBody{
@@ -725,8 +728,9 @@ func (c *WeComChannel) uploadOutboundMedia(
ChunkIndex: idx,
Base64Data: base64.StdEncoding.EncodeToString(data[offset:end]),
},
}, wecomUploadTimeout); err != nil {
return nil, err
}, wecomUploadTimeout)
if sendErr != nil {
return nil, sendErr
}
}
+6 -6
View File
@@ -734,11 +734,6 @@ func (c *WeComChannel) sendCommandAck(cmd wecomCommand, timeout time.Duration) (
return c.writeCurrentAck(cmd, timeout)
}
func (c *WeComChannel) writeCurrent(cmd wecomCommand, timeout time.Duration) error {
_, err := c.writeCurrentAck(cmd, timeout)
return err
}
func (c *WeComChannel) writeCurrentAck(cmd wecomCommand, timeout time.Duration) (wecomEnvelope, error) {
c.connMu.Lock()
conn := c.conn
@@ -788,7 +783,12 @@ func (c *WeComChannel) writeAndWaitAck(
select {
case env := <-waitCh:
if env.ErrCode != 0 {
return wecomEnvelope{}, fmt.Errorf("%w: wecom errcode=%d errmsg=%s", channels.ErrTemporary, env.ErrCode, env.ErrMsg)
return wecomEnvelope{}, fmt.Errorf(
"%w: wecom errcode=%d errmsg=%s",
channels.ErrTemporary,
env.ErrCode,
env.ErrMsg,
)
}
return env, nil
case <-timer.C:
+3 -2
View File
@@ -285,8 +285,9 @@ func TestSendMedia_UsesTurnImageAndFinishesStream(t *testing.T) {
StreamID: "stream-1",
CreatedAt: time.Now(),
})
if err := ch.routes.Put("chat-1", "req-1", 1, time.Hour); err != nil {
t.Fatalf("Put() error = %v", err)
putErr := ch.routes.Put("chat-1", "req-1", 1, time.Hour)
if putErr != nil {
t.Fatalf("Put() error = %v", putErr)
}
var commands []wecomCommand