refactor: 移除冗余的局部变量赋值和函数调用
All checks were successful
构建上传工具 / build-tool (push) Successful in 10m45s

This commit is contained in:
2025-10-25 17:11:12 +08:00
parent 444d7ebe21
commit efe2a92cf1

View File

@@ -299,7 +299,6 @@ func StartLooking(ctx context.Context, lookingPath string) {
g.SetLimit(config.APPConfig.HandleFileCount) // 设置最大同时处理文件数为50
// 执行所有任务
for _, task := range tasks {
task := task // 创建局部变量
g.Go(func() error {
select {
case <-ctx.Done():
@@ -333,7 +332,6 @@ func StartLooking(ctx context.Context, lookingPath string) {
AddLog("上传程序已退出")
return
case <-t.C:
f()
}
}
}
@@ -376,10 +374,10 @@ func processFile(ctx context.Context, filePath string, fileLines int) {
// 创建10个worker处理文件上传
for i := 0; i < config.APPConfig.ThreadCount; i++ {
wg.Add(1)
go func(workerID int) {
processLines(ctx, lines, workerID, filePath)
go func() {
processLines(ctx, lines, i, filePath)
wg.Done()
}(i)
}()
}
// 读取文件并发送到通道