github.com/myles-mcdonnell/glide@v0.12.3/repo/semver.go (about) 1 package repo 2 3 import ( 4 "github.com/Masterminds/semver" 5 "github.com/Masterminds/vcs" 6 ) 7 8 // Filter a list of versions to only included semantic versions. The response 9 // is a mapping of the original version to the semantic version. 10 func getSemVers(refs []string) []*semver.Version { 11 sv := []*semver.Version{} 12 for _, r := range refs { 13 v, err := semver.NewVersion(r) 14 if err == nil { 15 sv = append(sv, v) 16 } 17 } 18 19 return sv 20 } 21 22 // Get all the references for a repo. This includes the tags and branches. 23 func getAllVcsRefs(repo vcs.Repo) ([]string, error) { 24 tags, err := repo.Tags() 25 if err != nil { 26 return []string{}, err 27 } 28 29 branches, err := repo.Branches() 30 if err != nil { 31 return []string{}, err 32 } 33 34 return append(branches, tags...), nil 35 }