diff --git a/cmd/picoclaw/internal/gateway/helpers.go b/cmd/picoclaw/internal/gateway/helpers.go index c4a26c6a1..b1735c7ab 100644 --- a/cmd/picoclaw/internal/gateway/helpers.go +++ b/cmd/picoclaw/internal/gateway/helpers.go @@ -192,7 +192,7 @@ func gatewayCmd(debug bool) error { msgBus.Close() // Use a fresh context with timeout for graceful shutdown, - // since the original ctx is already cancelled. + // since the original ctx is already canceled. shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 15*time.Second) defer shutdownCancel() diff --git a/pkg/bus/bus_test.go b/pkg/bus/bus_test.go index cc3f6961f..a50586df1 100644 --- a/pkg/bus/bus_test.go +++ b/pkg/bus/bus_test.go @@ -73,13 +73,13 @@ func TestPublishInbound_ContextCancel(t *testing.T) { } } - // Now buffer is full; publish with a cancelled context + // Now buffer is full; publish with a canceled context cancelCtx, cancel := context.WithCancel(context.Background()) cancel() err := mb.PublishInbound(cancelCtx, InboundMessage{Content: "overflow"}) if err == nil { - t.Fatal("expected error from cancelled context, got nil") + t.Fatal("expected error from canceled context, got nil") } if err != context.Canceled { t.Fatalf("expected context.Canceled, got %v", err) @@ -115,7 +115,7 @@ func TestConsumeInbound_ContextCancel(t *testing.T) { _, ok := mb.ConsumeInbound(ctx) if ok { - t.Fatal("expected ok=false when context is cancelled") + t.Fatal("expected ok=false when context is canceled") } } diff --git a/pkg/channels/manager.go b/pkg/channels/manager.go index ae6eb3ce4..23a38c699 100644 --- a/pkg/channels/manager.go +++ b/pkg/channels/manager.go @@ -455,7 +455,7 @@ func (m *Manager) runWorker(ctx context.Context, name string, w *channelWorker) func (m *Manager) sendWithRetry(ctx context.Context, name string, w *channelWorker, msg bus.OutboundMessage) { // Rate limit: wait for token if err := w.limiter.Wait(ctx); err != nil { - // ctx cancelled, shutting down + // ctx canceled, shutting down return } diff --git a/pkg/channels/manager_test.go b/pkg/channels/manager_test.go index 45590584b..6b9f151c3 100644 --- a/pkg/channels/manager_test.go +++ b/pkg/channels/manager_test.go @@ -245,7 +245,7 @@ func TestSendWithRetry_ContextCancelled(t *testing.T) { m.sendWithRetry(ctx, "test", w, msg) - // Should have called Send once, then noticed ctx cancelled during backoff + // Should have called Send once, then noticed ctx canceled during backoff if callCount != 1 { t.Fatalf("expected 1 Send call before context cancellation, got %d", callCount) } diff --git a/pkg/channels/onebot/onebot.go b/pkg/channels/onebot/onebot.go index cddd374f8..f8042b248 100644 --- a/pkg/channels/onebot/onebot.go +++ b/pkg/channels/onebot/onebot.go @@ -469,7 +469,7 @@ func (c *OneBotChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMess continue } - segType := "image" + var segType string switch part.Type { case "image": segType = "image" diff --git a/pkg/channels/telegram/telegram.go b/pkg/channels/telegram/telegram.go index 74642a796..3e4e4d398 100644 --- a/pkg/channels/telegram/telegram.go +++ b/pkg/channels/telegram/telegram.go @@ -243,11 +243,6 @@ func (c *TelegramChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMe continue } - filename := part.Filename - if filename == "" { - filename = "file" - } - switch part.Type { case "image": params := &telego.SendPhotoParams{ diff --git a/pkg/channels/wecom/app.go b/pkg/channels/wecom/app.go index 287017c1c..073848bf3 100644 --- a/pkg/channels/wecom/app.go +++ b/pkg/channels/wecom/app.go @@ -221,7 +221,7 @@ func (c *WeComAppChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMe } // Map part type to WeCom media type - mediaType := "file" + var mediaType string switch part.Type { case "image": mediaType = "image"