func listFile(dir string) { addFilterOut(".DS_Store") files, _ := ioutil.ReadDir(dir) for _, file := range files { subfile := dir + "/" + file.Name() if file.IsDir() { listFile(subfile) } else if notInFilterOut(file.Name()) { content, err := com.ReadFileString(subfile) if err != nil { templates[subfile] = "" } else { content = "{{define \"" + subfile + "\"}}" + content + "{{end}}" content = lefTplDir(content, templatefolder) subfile = lefTplDir(subfile, templatefolder) templates[subfile] = content } } } // get template name list getTemplateNames() }
func (cfg *Config) readConfigFile() (string, error) { rawContent, err := com.ReadFileString(cfg.path) cfg.rawContent = rawContent return cfg.rawContent, err }