diff --git a/config-configure.go b/config-configure.go index e8eac9c..baba002 100644 --- a/config-configure.go +++ b/config-configure.go @@ -17,7 +17,7 @@ type ConfigConfigure struct { func (receiver *ConfigConfigure) Check() { if receiver.ContainerType == None { - log.Fatal("Check, ContainerType should not be None or empty ") + log.Fatal("Check, ContainerType should not be None or Empty ") } else if receiver.ContainerType == BesidesExe { // pass } else if receiver.ContainerType == UserConfig { @@ -33,19 +33,19 @@ func (receiver *ConfigConfigure) Check() { func (receiver *ConfigConfigure) MakeupContainerPath() { if receiver.ContainerType == None { - log.Fatal("Error making container path, ContainerType must be specified") + log.Fatal("Error Making Container Path, ContainerType must be Specified") } else if receiver.ContainerType == BesidesExe { receiver.ContainerPath = getConfigContainerBesidesExe() } else if receiver.ContainerType == UserConfig { receiver.ContainerPath = getConfigContainerUserConfig(receiver.AppName) } else if receiver.ContainerType == SystemConfig { - log.Fatal("Error making container path, SystemConfig is not supported for now") + log.Fatal("Error Making Container Path, SystemConfig is not Supported for now") } } func (receiver *ConfigConfigure) EnsureContainer() { if receiver.ContainerPath == "" { - log.Fatal("Error ensuring container, ContainerPath should not be empty") + log.Fatal("Error Ensuring Container, ContainerPath should not be Empty") } // 检查目录是否存在 @@ -53,13 +53,13 @@ func (receiver *ConfigConfigure) EnsureContainer() { // 如果目录不存在,则创建 err := os.MkdirAll(receiver.ContainerPath, 0755) if err != nil { - log.Fatal("Failed to create container directory: ", err) + log.Fatal("Failed to Create Container Directory: ", err) } - log.Printf("Container directory created: %s", receiver.ContainerPath) + log.Printf("Container Directory Created: %s", receiver.ContainerPath) } else if err != nil { - log.Fatal("Failed to check container directory: ", err) + log.Fatal("Failed to Check Container Directory: ", err) } else { - log.Printf("Container directory already exists: %s", receiver.ContainerPath) + log.Printf("Container Directory Already Exists: %s", receiver.ContainerPath) } } @@ -72,30 +72,30 @@ func (receiver *ConfigConfigure) EnsureConfigure(defaultConfig interface{}) inte // 配置文件存在,读取并反序列化到目标结构体 data, err := os.ReadFile(configFile) if err != nil { - log.Fatalf("Failed to read config file: %v", err) + log.Fatalf("Failed to Read Config File: %v", err) } // 使用反射获取 defaultConfig 的类型 val := reflect.New(reflect.TypeOf(defaultConfig)).Interface() if err := json.Unmarshal(data, val); err != nil { - log.Fatalf("Failed to unmarshal config file: %v", err) + log.Fatalf("Failed to Unmarshal Config File: %v", err) } - log.Printf("Loaded config from file: %s", configFile) + log.Printf("Loaded Config from File: %s", configFile) return reflect.ValueOf(val).Elem().Interface() } else if os.IsNotExist(err) { // 配置文件不存在,保存默认配置到文件 jsonData, err := json.MarshalIndent(defaultConfig, "", " ") if err != nil { - log.Fatalf("Error encoding default config: %v", err) + log.Fatalf("Error Encoding Default Config: %v", err) } if err := os.WriteFile(configFile, jsonData, 0644); err != nil { - log.Fatalf("Failed to write default config to file: %v", err) + log.Fatalf("Failed to Write Default Config to File: %v", err) } - log.Printf("Saved default config to file: %s", configFile) + log.Printf("Saved Default Config to File: %s", configFile) return defaultConfig } else { // 其他错误 - log.Fatalf("Error checking config file: %v", err) + log.Fatalf("Error Checking Config File: %v", err) } return defaultConfig } diff --git a/path-helper.go b/path-helper.go index e3d5861..c4cb42a 100644 --- a/path-helper.go +++ b/path-helper.go @@ -34,6 +34,6 @@ func getConfigContainerUserConfig(appName string) string { } func getConfigContainerSystemConfig(appName string) string { - log.Fatal("Error, not implemented yet") + log.Fatal("Error, not Implemented yet") return "" }