You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	fix: properly translate mips arch (#2126)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							57a69dbe47
						
					
				
				
					commit
					12c7d38eb9
				
			| @@ -6,7 +6,10 @@ import "strings" | ||||
| // Arch converts a goarch to a linux-compatible arch. | ||||
| func Arch(key string) string { | ||||
| 	// XXX: list of all linux arches: `go tool dist list | grep linux` | ||||
| 	var arch = strings.TrimPrefix(key, "linux") | ||||
| 	arch := strings.TrimPrefix(key, "linux") | ||||
| 	for _, suffix := range []string{"hardfloat", "softfloat"} { | ||||
| 		arch = strings.TrimSuffix(arch, suffix) | ||||
| 	} | ||||
| 	switch arch { | ||||
| 	case "386": | ||||
| 		return "i386" | ||||
| @@ -18,7 +21,10 @@ func Arch(key string) string { | ||||
| 		return "armhf" | ||||
| 	case "arm7": // GOARCH + GOARM | ||||
| 		return "armhf" | ||||
| 	default: | ||||
| 		return arch | ||||
| 	case "mips64le": | ||||
| 		return "mips64el" | ||||
| 	case "mipsle": | ||||
| 		return "mipsel" | ||||
| 	} | ||||
| 	return arch | ||||
| } | ||||
|   | ||||
| @@ -9,15 +9,19 @@ import ( | ||||
|  | ||||
| func TestArch(t *testing.T) { | ||||
| 	for from, to := range map[string]string{ | ||||
| 		"linuxamd64":   "amd64", | ||||
| 		"linux386":     "i386", | ||||
| 		"linuxarm64":   "arm64", | ||||
| 		"linuxarm5":    "armel", | ||||
| 		"linuxarm6":    "armhf", | ||||
| 		"linuxarm7":    "armhf", | ||||
| 		"linuxppc64":   "ppc64", | ||||
| 		"linuxppc64le": "ppc64le", | ||||
| 		"linuxwhat":    "what", | ||||
| 		"linuxamd64":             "amd64", | ||||
| 		"linux386":               "i386", | ||||
| 		"linuxarm64":             "arm64", | ||||
| 		"linuxarm5":              "armel", | ||||
| 		"linuxarm6":              "armhf", | ||||
| 		"linuxarm7":              "armhf", | ||||
| 		"linuxppc64":             "ppc64", | ||||
| 		"linuxppc64le":           "ppc64le", | ||||
| 		"linuxwhat":              "what", | ||||
| 		"linuxmips64lesoftfloat": "mips64el", | ||||
| 		"linuxmipslehardfloat":   "mipsel", | ||||
| 		"linuxmipssoftfloat":     "mips", | ||||
| 		"linuxmips64hardfloat":   "mips64", | ||||
| 	} { | ||||
| 		t.Run(fmt.Sprintf("%s to %s", from, to), func(t *testing.T) { | ||||
| 			require.Equal(t, to, Arch(from)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user