fscan/main.go
ZacharyZcR d570be1f50 Linus式插件系统重写第一阶段完成
- 删除460行过度工程代码,替换为273行简洁实现
- 统一三套独立注册系统为单一全局注册表
- 删除app/container.go容器依赖注入系统(107行)
- 删除app/initializer.go复杂初始化器(75行)
- 删除core/PluginAdapter.go适配器层(82行)
- 删除plugins/{services,web,local}/init.go重复代码(238行)
- 创建plugins/init.go统一插件接口(116行)
- 添加向后兼容适配层保持现有插件不变

架构简化效果:
- 代码减少: 460行 → 273行 (减少41%)
- 接口统一: 3个Plugin接口 → 1个Plugin接口
- 注册系统: 3套独立系统 → 1套全局系统
- 消除特殊情况,符合'好代码没有特殊情况'原则

编译测试通过,基本功能验证正常
2025-08-26 18:03:57 +08:00

43 lines
853 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"fmt"
"os"
"github.com/shadow1ng/fscan/common"
"github.com/shadow1ng/fscan/core"
// 导入统一插件系统
_ "github.com/shadow1ng/fscan/plugins/services"
_ "github.com/shadow1ng/fscan/plugins/web"
_ "github.com/shadow1ng/fscan/plugins/local"
)
func main() {
// Linus式简化直接执行删除过度工程
var info common.HostInfo
common.Flag(&info)
// 初始化日志
common.InitLogger()
// 解析和验证参数
if err := common.Parse(&info); err != nil {
handleError("参数解析失败", err)
}
// 初始化输出系统
if err := common.InitOutput(); err != nil {
handleError("输出初始化失败", err)
}
defer common.CloseOutput()
// 执行扫描
core.RunScan(info)
}
func handleError(msg string, err error) {
common.LogError(fmt.Sprintf("%s: %v", msg, err))
os.Exit(1)
}