github.com/aminjam/goflat@v0.4.1-0.20160331105230-ec639fc0d5b3/.examples/inputs/repos.go (about) 1 package main 2 3 type Repos []struct { 4 Name string 5 Repo string 6 Branch string 7 } 8 9 func (r Repos) Names() []string { 10 names := make([]string, len(r)) 11 for k, v := range r { 12 names[k] = v.Name 13 } 14 return names 15 } 16 17 func NewRepos() Repos { 18 return Repos{ 19 { 20 Name: "repo1", 21 Repo: "https://github.com/jane/repo1", 22 Branch: "master", 23 }, 24 { 25 Name: "repo2", 26 Repo: "https://github.com/john/repo2", 27 Branch: "develop", 28 }, 29 } 30 }