fix: resolve golangci-lint errcheck and staticcheck warnings

This commit is contained in:
ZacharyZcR
2026-05-12 15:41:15 +08:00
parent 660e0574ef
commit 7db89e0bd3
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -158,11 +158,11 @@ func (l *Logger) log(level LogLevel, content string) {
lines := strings.Split(content, "\n")
for _, line := range lines {
if line != "" {
fmt.Fprintf(l.debugFile, "[%s] %s %s\n", timestamp, prefix, line)
_, _ = fmt.Fprintf(l.debugFile, "[%s] %s %s\n", timestamp, prefix, line)
}
}
} else {
fmt.Fprintf(l.debugFile, "[%s] %s %s\n", timestamp, prefix, content)
_, _ = fmt.Fprintf(l.debugFile, "[%s] %s %s\n", timestamp, prefix, content)
}
}
+3 -3
View File
@@ -69,7 +69,7 @@ func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo, sessio
}
}
output.WriteString(fmt.Sprintf("扫描进程数: %d\n\n", len(processes)))
_, _ = fmt.Fprintf(&output, "扫描进程数: %d\n\n", len(processes))
// 检测AV产品 - 使用JSON数据库
for avName, avProduct := range p.avProducts {
@@ -92,13 +92,13 @@ func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo, sessio
if len(foundProcesses) > 0 {
detectedAVs = append(detectedAVs, avName)
output.WriteString(fmt.Sprintf("✓ 检测到 %s:\n", avName))
_, _ = fmt.Fprintf(&output, "✓ 检测到 %s:\n", avName)
common.LogSuccess(i18n.Tr("avdetect_found", avName, len(foundProcesses)))
// 输出详细进程信息到控制台
for _, proc := range foundProcesses {
output.WriteString(fmt.Sprintf(" - %s\n", proc))
_, _ = fmt.Fprintf(&output, " - %s\n", proc)
common.LogInfo(i18n.Tr("avdetect_process", proc))
}
output.WriteString("\n")