feat(linter): Fix govet linter
This commit is contained in:
17 files changed
+29
-61
No files matched your search
@@ -267,10 +267,10 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
|
||||
|
||||
transcribedText := ""
|
||||
if c.transcriber != nil && c.transcriber.IsAvailable() {
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
transcriberCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
result, err := c.transcriber.Transcribe(ctx, voicePath)
|
||||
result, err := c.transcriber.Transcribe(transcriberCtx, voicePath)
|
||||
if err != nil {
|
||||
logger.ErrorCF("telegram", "Voice transcription failed", map[string]any{
|
||||
"error": err.Error(),
|
||||
|
||||
@@ -272,7 +272,7 @@ func (c *WeComBotChannel) handleMessageCallback(ctx context.Context, w http.Resp
|
||||
AgentID string `xml:"AgentID"`
|
||||
}
|
||||
|
||||
if err := xml.Unmarshal(body, &encryptedMsg); err != nil {
|
||||
if err = xml.Unmarshal(body, &encryptedMsg); err != nil {
|
||||
logger.ErrorCF("wecom", "Failed to parse XML", map[string]any{
|
||||
"error": err.Error(),
|
||||
})
|
||||
|
||||
@@ -348,7 +348,7 @@ func (c *WeComAppChannel) handleMessageCallback(ctx context.Context, w http.Resp
|
||||
AgentID string `xml:"AgentID"`
|
||||
}
|
||||
|
||||
if err := xml.Unmarshal(body, &encryptedMsg); err != nil {
|
||||
if err = xml.Unmarshal(body, &encryptedMsg); err != nil {
|
||||
logger.ErrorCF("wecom_app", "Failed to parse XML", map[string]any{
|
||||
"error": err.Error(),
|
||||
})
|
||||
|
||||
@@ -852,19 +852,6 @@ func TestWeComAppMessageStructures(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("WeComImageMessage structure", func(t *testing.T) {
|
||||
msg := WeComImageMessage{
|
||||
ToUser: "user123",
|
||||
MsgType: "image",
|
||||
AgentID: 1000002,
|
||||
}
|
||||
msg.Image.MediaID = "media_123456"
|
||||
|
||||
if msg.Image.MediaID != "media_123456" {
|
||||
t.Errorf("Image.MediaID = %q, want %q", msg.Image.MediaID, "media_123456")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("WeComAccessTokenResponse structure", func(t *testing.T) {
|
||||
jsonData := `{
|
||||
"errcode": 0,
|
||||
|
||||
@@ -198,10 +198,8 @@ func TestWeComBotVerifySignature(t *testing.T) {
|
||||
Token: "",
|
||||
WebhookURL: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test",
|
||||
}
|
||||
base := NewBaseChannel("wecom", cfgEmpty, msgBus, cfgEmpty.AllowFrom)
|
||||
chEmpty := &WeComBotChannel{
|
||||
BaseChannel: base,
|
||||
config: cfgEmpty,
|
||||
config: cfgEmpty,
|
||||
}
|
||||
|
||||
if !WeComVerifySignature(chEmpty.config.Token, "any_sig", "any_ts", "any_nonce", "any_msg") {
|
||||
|
||||
Reference in new issue
Block a user