func name(url string) string {
	filename := path.Base(url)
	if filename == "." || filename == "/" {
		return ""
	}

	delim := '-'
	fields := strings.FieldsFunc(filename, func(c rune) bool {
		if c == '-' || c == '_' {
			delim = c
			return true
		}
		return false
	})

	version := regexp.MustCompile(`^(v\d+\.|\d+)`) // e.g. v1.2.3, v3, 93
	platform := regexp.MustCompile(`(?i)(linux|windows|.*bsd|unknown)`)
	arch := regexp.MustCompile(`(?i)(i.86|amd64|x86|x64|x86[-_]64|arm.*|aarch.*|mips.*|powerpc.*|sparc.*|s390.*)`)

	i := 0
	for i = 0; i < len(fields); i++ {
		if version.MatchString(fields[i]) {
			break
		}
		if platform.MatchString(fields[i]) {
			break
		}
		if arch.MatchString(fields[i]) {
			break
		}
	}

	return strings.Join(fields[:i], string(delim))
}
// name parses url for a name without version and extension suffixes
name parses url for a name without version and extension suffixes
// name parses url for a name without version and extension suffixes
func name(url string) string {
	filename := path.Base(url)
	if filename == "." || filename == "/" {
		return ""
	}
	delim := '-'
	fields := strings.FieldsFunc(filename, func(c rune) bool {
		if c == '-' || c == '_' {
			delim = c
			return true
		}
		return false
	})
	version := regexp.MustCompile(`^(v\d+\.|\d+)`) 
	platform := regexp.MustCompile(`(?i)(linux|windows|.*bsd|unknown)`)
	arch := regexp.MustCompile(`(?i)(i.86|amd64|x86|x64|x86[-_]64|arm.*|aarch.*|mips.*|powerpc.*|sparc.*|s390.*)`)
	i := 0
	for i = 0; i < len(fields); i++ {
		if version.MatchString(fields[i]) {
			break
		}
		if platform.MatchString(fields[i]) {
			break
		}
		if arch.MatchString(fields[i]) {
			break
		}
	}
	return strings.Join(fields[:i], string(delim))
}
func name ( url string ) string { filename := path . Base ( url ) if filename == " " || filename == " " { return " " } delim := '-' fields := strings . FieldsFunc ( filename , func ( c rune ) bool { if c == '-' || c == '_' { delim = c return true } return false } ) version := regexp . MustCompile ( `^(v\d+\.|\d+)` ) platform := regexp . MustCompile ( `(?i)(linux|windows|.*bsd|unknown)` ) arch := regexp . MustCompile ( `(?i)(i.86|amd64|x86|x64|x86[-_]64|arm.*|aarch.*|mips.*|powerpc.*|sparc.*|s390.*)` ) i := 0 for i = 0 ; i < len ( fields ) ; i ++ { if version . MatchString ( fields [ i ] ) { break } if platform . MatchString ( fields [ i ] ) { break } if arch . MatchString ( fields [ i ] ) { break } } return strings . Join ( fields [ : i ] , string ( delim ) ) }
name parses url for a name without version and extension suffixes
name parses url for a name without version and extension suffixes
// e.g. v1.2.3, v3, 93