fix: resolve lint errors (gci, golines, unused variable)

- Fix import ordering (gci) in 8 files
- Break long line in openai_compat/provider.go (golines)
- Remove unused absolutePathPattern in tools/shell.go

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-03-02 03:55:59 +09:00
parent 8336d3f6dc
commit 9eb9df914e
9 changed files with 60 additions and 64 deletions

View file

@ -255,7 +255,6 @@ func (c *DiscordChannel) SendWithID(ctx context.Context, chatID string, content
}
}
// EditMessage implements channels.MessageEditor.
func (c *DiscordChannel) EditMessage(ctx context.Context, chatID string, messageID string, content string) error {
_, err := c.session.ChannelMessageEdit(chatID, messageID, content)

View file

@ -28,7 +28,6 @@ type MessageSenderWithID interface {
SendWithID(ctx context.Context, chatID string, content string) (messageID string, err error)
}
// PlaceholderCapable — channels that can send a placeholder message
// (e.g. "Thinking... 💭") that will later be edited to the actual response.
// The channel MUST also implement MessageEditor for the placeholder to be useful.

View file

@ -63,7 +63,6 @@ type statusMsgEntry struct {
createdAt time.Time
}
// channelRateConfig maps channel name to per-second rate limit.
var channelRateConfig = map[string]float64{
"telegram": 20,
@ -559,7 +558,6 @@ func (m *Manager) handleTaskStatusSend(ctx context.Context, name string, w *chan
_ = w.ch.Send(ctx, msg)
}
// sendWithRetry sends a message through the channel with rate limiting and
// retry logic. It classifies errors to determine the retry strategy:
// - ErrNotRunning / ErrSendFailed: permanent, no retry

View file

@ -170,7 +170,6 @@ func (c *PicoChannel) SendWithID(ctx context.Context, chatID string, content str
return msgID, nil
}
// EditMessage implements channels.MessageEditor.
func (c *PicoChannel) EditMessage(ctx context.Context, chatID string, messageID string, content string) error {
outMsg := newMessage(TypeMessageUpdate, map[string]any{

View file

@ -318,7 +318,6 @@ func (c *SlackChannel) handleMessageEvent(ev *slackevents.MessageEvent) {
var mediaPaths []string
scope := channels.BuildMediaScope("slack", chatID, messageTS)
// Helper to register a local file with the media store

View file

@ -221,7 +221,6 @@ func (c *TelegramChannel) SendWithID(ctx context.Context, chatID string, content
return fmt.Sprintf("%d", sent.MessageID), nil
}
// StartTyping implements channels.TypingCapable.
// It sends ChatAction(typing) immediately and then repeats every 4 seconds
// (Telegram's typing indicator expires after ~5s) in a background goroutine.

View file

@ -596,7 +596,17 @@ func normalizeModel(model, apiBase string) string {
prefix := strings.ToLower(before)
switch prefix {
case "openai", "moonshot", "nvidia", "groq", "ollama", "deepseek", "google", "openrouter", "zhipu", "minimax", "mistral":
case "openai",
"moonshot",
"nvidia",
"groq",
"ollama",
"deepseek",
"google",
"openrouter",
"zhipu",
"minimax",
"mistral":
return after
default:
return model

View file

@ -134,8 +134,7 @@ type ExecTool struct {
bgCtx context.Context
}
var (
defaultDenyPatterns = []*regexp.Regexp{
var defaultDenyPatterns = []*regexp.Regexp{
regexp.MustCompile(`\brm\s+-[rf]{1,2}\b`),
regexp.MustCompile(`\bdel\s+/[fq]\b`),
regexp.MustCompile(`\brmdir\s+/s\b`),
@ -185,11 +184,6 @@ var (
regexp.MustCompile(`\bsource\s+.*\.sh\b`),
}
// absolutePathPattern matches absolute file paths in commands (Unix and Windows).
absolutePathPattern = regexp.MustCompile(`[A-Za-z]:\\[^\\\"']+|/[^\s\"']+`)
)
func NewExecTool(workingDir string, restrict bool) (*ExecTool, error) {
return NewExecToolWithConfig(workingDir, restrict, nil)
}

View file

@ -95,7 +95,6 @@ func DetectRepetitionLoop(text string) bool {
return ratio < repetitionUniqueThreshold
}
// SanitizeMessageContent removes Unicode control characters, format characters (RTL overrides,
// zero-width characters), and other non-graphic characters that could confuse an LLM
// or cause display issues in the agent UI.