diff --git a/Common/Parse.go b/Common/Parse.go index 6e2c4b7..eeb104f 100644 --- a/Common/Parse.go +++ b/Common/Parse.go @@ -263,10 +263,10 @@ func updateGlobalVariables(config *parsers.ParsedConfig, info *HostInfo) error { // 更新目标相关全局变量 if config.Targets != nil { if len(config.Targets.Hosts) > 0 { + // 如果info.Host已经有值,说明解析结果来自info.Host,不需要重复设置 + // 只有当info.Host为空时才设置(如从文件读取的情况) if info.Host == "" { info.Host = joinStrings(config.Targets.Hosts, ",") - } else { - info.Host += "," + joinStrings(config.Targets.Hosts, ",") } }