예제 #1
0
// MapFetchableUrl checks a type to see if it is either a short git hub url or a fully specified URL
// and returns the URL that should be used to fetch it. If the url is not fetchable (primitive type for
// example) will return empty string.
func (tr *typeResolver) MapFetchableURL(t string) (string, error) {
	if util.IsGithubShortType(t) {
		return tr.ShortTypeToDownloadURL(t)
	} else if util.IsHttpUrl(t) {
		return t, nil
	}
	return "", nil
}
// MapFetchableUrls checks a type to see if it is either a short git hub url or a fully specified URL
// and returns the URL that should be used to fetch it. If the url is not fetchable (primitive type for
// example) will return empty string.
func (tr *typeResolver) MapFetchableURLs(t string) ([]string, error) {
	if util.IsGithubShortType(t) {
		return tr.ShortTypeToDownloadURLs(t)
	} else if util.IsGithubShortPackageType(t) {
		return tr.ShortTypeToPackageDownloadURLs(t)
	} else if util.IsHttpUrl(t) {
		return []string{t}, nil
	}
	return []string{}, nil
}