fix: correct indentation and octal literals for linter

Fix gci errors caused by lost indentation when removing localFiles
lines, and use 0o700/0o600 octal syntax for gofumpt compliance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ex-takashima 2026-02-22 14:28:51 +09:00
parent a56d97f233
commit 81df10b0b1
4 changed files with 11 additions and 11 deletions

View file

@ -317,19 +317,19 @@ func (c *LINEChannel) processEvent(event lineEvent) {
case "image":
localPath := c.downloadContent(msg.ID, "image.jpg")
if localPath != "" {
mediaPaths = append(mediaPaths, localPath)
mediaPaths = append(mediaPaths, localPath)
content = "[image]"
}
case "audio":
localPath := c.downloadContent(msg.ID, "audio.m4a")
if localPath != "" {
mediaPaths = append(mediaPaths, localPath)
mediaPaths = append(mediaPaths, localPath)
content = "[audio]"
}
case "video":
localPath := c.downloadContent(msg.ID, "video.mp4")
if localPath != "" {
mediaPaths = append(mediaPaths, localPath)
mediaPaths = append(mediaPaths, localPath)
content = "[video]"
}
case "file":

View file

@ -238,7 +238,7 @@ func (c *SlackChannel) handleMessageEvent(ev *slackevents.MessageEvent) {
if localPath == "" {
continue
}
mediaPaths = append(mediaPaths, localPath)
mediaPaths = append(mediaPaths, localPath)
if utils.IsAudioFile(file.Name, file.Mimetype) && c.transcriber != nil && c.transcriber.IsAvailable() {
ctx, cancel := context.WithTimeout(c.ctx, 30*time.Second)

View file

@ -237,7 +237,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
photo := message.Photo[len(message.Photo)-1]
photoPath := c.downloadPhoto(ctx, photo.FileID)
if photoPath != "" {
mediaPaths = append(mediaPaths, photoPath)
mediaPaths = append(mediaPaths, photoPath)
if content != "" {
content += "\n"
}
@ -248,7 +248,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
if message.Voice != nil {
voicePath := c.downloadFile(ctx, message.Voice.FileID, ".ogg")
if voicePath != "" {
mediaPaths = append(mediaPaths, voicePath)
mediaPaths = append(mediaPaths, voicePath)
transcribedText := ""
if c.transcriber != nil && c.transcriber.IsAvailable() {
@ -282,7 +282,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
if message.Audio != nil {
audioPath := c.downloadFile(ctx, message.Audio.FileID, ".mp3")
if audioPath != "" {
mediaPaths = append(mediaPaths, audioPath)
mediaPaths = append(mediaPaths, audioPath)
if content != "" {
content += "\n"
}
@ -293,7 +293,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
if message.Document != nil {
docPath := c.downloadFile(ctx, message.Document.FileID, "")
if docPath != "" {
mediaPaths = append(mediaPaths, docPath)
mediaPaths = append(mediaPaths, docPath)
if content != "" {
content += "\n"
}

View file

@ -10,13 +10,13 @@ import (
func TestMediaCleanerRemovesOldFiles(t *testing.T) {
// Setup: create a temp media directory with old and new files
mediaDir := filepath.Join(os.TempDir(), MediaDir)
if err := os.MkdirAll(mediaDir, 0700); err != nil {
if err := os.MkdirAll(mediaDir, 0o700); err != nil {
t.Fatalf("failed to create media dir: %v", err)
}
// Create an "old" file and backdate its modification time
oldFile := filepath.Join(mediaDir, "test_old_file.jpg")
if err := os.WriteFile(oldFile, []byte("old"), 0600); err != nil {
if err := os.WriteFile(oldFile, []byte("old"), 0o600); err != nil {
t.Fatalf("failed to create old file: %v", err)
}
oldTime := time.Now().Add(-1 * time.Hour)
@ -26,7 +26,7 @@ func TestMediaCleanerRemovesOldFiles(t *testing.T) {
// Create a "new" file (just created, so modtime is now)
newFile := filepath.Join(mediaDir, "test_new_file.jpg")
if err := os.WriteFile(newFile, []byte("new"), 0600); err != nil {
if err := os.WriteFile(newFile, []byte("new"), 0o600); err != nil {
t.Fatalf("failed to create new file: %v", err)
}