增加命令功能
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// TargetConfig 配置
|
||||
type TargetConfig struct {
|
||||
// MapConfig 配置
|
||||
type MapConfig struct {
|
||||
Targets map[string]*Target `json:"targets"`
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ type Target struct {
|
||||
}
|
||||
|
||||
// LoadConfigFile 加载配置文件
|
||||
func LoadTargetFile(filename string) (*TargetConfig, error) {
|
||||
func LoadMapFile(filename string) (*MapConfig, error) {
|
||||
// 打开文件
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
@@ -31,7 +31,7 @@ func LoadTargetFile(filename string) (*TargetConfig, error) {
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
sc := &TargetConfig{}
|
||||
sc := &MapConfig{}
|
||||
|
||||
err = json.NewDecoder(f).Decode(sc)
|
||||
return sc, err
|
||||
|
||||
Reference in New Issue
Block a user