mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-26 21:21:53 +08:00
fix: resolve golangci-lint errcheck and staticcheck warnings
This commit is contained in:
+2
-1
@@ -16,7 +16,8 @@ type dnsCache struct {
|
|||||||
// ResolveIP 解析 host 为 *net.IPAddr,结果缓存
|
// ResolveIP 解析 host 为 *net.IPAddr,结果缓存
|
||||||
func (c *dnsCache) ResolveIP(host string) (*net.IPAddr, error) {
|
func (c *dnsCache) ResolveIP(host string) (*net.IPAddr, error) {
|
||||||
if v, ok := c.m.Load(host); ok {
|
if v, ok := c.m.Load(host); ok {
|
||||||
return v.(*net.IPAddr), nil
|
addr, _ := v.(*net.IPAddr)
|
||||||
|
return addr, nil
|
||||||
}
|
}
|
||||||
addr, err := net.ResolveIPAddr("ip", host)
|
addr, err := net.ResolveIPAddr("ip", host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo, sessio
|
|||||||
|
|
||||||
// 统计结果
|
// 统计结果
|
||||||
output.WriteString("=== 检测结果 ===\n")
|
output.WriteString("=== 检测结果 ===\n")
|
||||||
output.WriteString(fmt.Sprintf("检测到的AV产品: %d个\n", len(detectedAVs)))
|
_, _ = fmt.Fprintf(&output, "检测到的AV产品: %d个\n", len(detectedAVs))
|
||||||
|
|
||||||
if len(detectedAVs) > 0 {
|
if len(detectedAVs) > 0 {
|
||||||
output.WriteString("检测到的产品: " + strings.Join(detectedAVs, ", ") + "\n")
|
output.WriteString("检测到的产品: " + strings.Join(detectedAVs, ", ") + "\n")
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if p.removeFile(file) {
|
if p.removeFile(file) {
|
||||||
filesCleared++
|
filesCleared++
|
||||||
output.WriteString(fmt.Sprintf("清理文件: %s\n", file))
|
_, _ = fmt.Fprintf(&output, "清理文件: %s\n", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo, session
|
|||||||
for _, file := range tempFiles {
|
for _, file := range tempFiles {
|
||||||
if p.removeFile(file) {
|
if p.removeFile(file) {
|
||||||
filesCleared++
|
filesCleared++
|
||||||
output.WriteString(fmt.Sprintf("清理临时文件: %s\n", file))
|
_, _ = fmt.Fprintf(&output, "清理临时文件: %s\n", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user