func FileReplace(path string, data map[string]string) { rawContent, err := utils.ReadFile(path) checkErr(err) rawContent = []byte(StringReplace(string(rawContent), data)) checkErr(utils.WriteFile(path, rawContent, false)) }
func FileReplaceToken(path, token, newContent string) bool { contents, err := utils.ReadFile(path) if err != nil { return false } newContent, ok := ReplaceToken(token, string(contents), newContent) if !ok { return false } contents = []byte(newContent) if err := utils.WriteFile(path, []byte(contents), false); err != nil { return false } return true }