From e6440d582f9fe35b6511485c9703acfb930a4513 Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Mon, 3 Nov 2025 19:54:47 +0800 Subject: [PATCH] fix: resolve go vet warnings for non-constant format strings Replace log.Printf with log.Print for static strings to resolve go vet warnings about non-constant format strings. This is a security best practice as using Printf with dynamic strings can lead to format string vulnerabilities. Fixed 6 instances in trader/auto_trader.go: - Line 260: Decision cycle separator (=) - Line 262: Decision cycle separator (=) - Line 349: System prompt separator (=) - Line 353: System prompt separator (=) - Line 357: CoT trace separator (-) - Line 361: CoT trace separator (-) --- trader/auto_trader.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/trader/auto_trader.go b/trader/auto_trader.go index b23bb052..d27fcd35 100644 --- a/trader/auto_trader.go +++ b/trader/auto_trader.go @@ -257,9 +257,9 @@ func (at *AutoTrader) Stop() { func (at *AutoTrader) runCycle() error { at.callCount++ - log.Printf("\n" + strings.Repeat("=", 70)) + log.Print("\n" + strings.Repeat("=", 70)) log.Printf("⏰ %s - AI决策周期 #%d", time.Now().Format("2006-01-02 15:04:05"), at.callCount) - log.Printf(strings.Repeat("=", 70)) + log.Print(strings.Repeat("=", 70)) // 创建决策记录 record := &logger.DecisionRecord{ @@ -346,19 +346,19 @@ func (at *AutoTrader) runCycle() error { // 打印系统提示词和AI思维链(即使有错误,也要输出以便调试) if decision != nil { if decision.SystemPrompt != "" { - log.Printf("\n" + strings.Repeat("=", 70)) + log.Print("\n" + strings.Repeat("=", 70)) log.Printf("📋 系统提示词 [模板: %s] (错误情况)", at.systemPromptTemplate) log.Println(strings.Repeat("=", 70)) log.Println(decision.SystemPrompt) - log.Printf(strings.Repeat("=", 70) + "\n") + log.Print(strings.Repeat("=", 70) + "\n") } if decision.CoTTrace != "" { - log.Printf("\n" + strings.Repeat("-", 70)) + log.Print("\n" + strings.Repeat("-", 70)) log.Println("💭 AI思维链分析(错误情况):") log.Println(strings.Repeat("-", 70)) log.Println(decision.CoTTrace) - log.Printf(strings.Repeat("-", 70) + "\n") + log.Print(strings.Repeat("-", 70) + "\n") } }