package repolist import ( "io/ioutil" "os" "path/filepath" "strings" "go.wit.com/log" ) func (v *RepoList) InitRepoList(cfgfile string) { lines := parsecfg(cfgfile) for _, line := range lines { log.Verbose("repo =", line) line = strings.TrimSpace(line) if strings.HasPrefix(line, "#") { continue } parts := strings.Split(line, " ") if len(parts) > 0 { path := parts[0] v.NewRepo(path) } } } func parsecfg(f string) []string { homeDir, _ := os.UserHomeDir() cfgfile := filepath.Join(homeDir, f) content, _ := ioutil.ReadFile(cfgfile) out := string(content) out = strings.TrimSpace(out) lines := strings.Split(out, "\n") return lines }