From 52531ee03daff211299abec94f541f1068eb6919 Mon Sep 17 00:00:00 2001 From: Francisco Guimaraes Date: Tue, 26 Jul 2016 20:13:36 -0300 Subject: [PATCH 1/4] - Implemented GOARM according to https://github.com/golang/go/wiki/GoArm - Need more tests - Need fix broken tests --- .gitignore | 2 +- go.go | 6 +++ main.go | 10 +++- platform.go | 89 +++++++++++++++++++++------------- platform_flag.go | 25 +++++----- platform_flag_test.go | 108 +++++++++++++++++++++--------------------- 6 files changed, 139 insertions(+), 101 deletions(-) diff --git a/.gitignore b/.gitignore index 68c6339..983a27e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -gox +gox* diff --git a/go.go b/go.go index b0633e7..f8e1549 100644 --- a/go.go +++ b/go.go @@ -18,6 +18,7 @@ type OutputTemplateData struct { Dir string OS string Arch string + ARM string } type CompileOpts struct { @@ -52,6 +53,10 @@ func GoCrossCompile(opts *CompileOpts) error { env = append(env, "CGO_ENABLED=0") } + if len(opts.Platform.ARM) > 0 { + env = append(env, "GOARM="+opts.Platform.ARM) + } + var outputPath bytes.Buffer tpl, err := template.New("output").Parse(opts.OutputTpl) if err != nil { @@ -61,6 +66,7 @@ func GoCrossCompile(opts *CompileOpts) error { Dir: filepath.Base(opts.PackagePath), OS: opts.Platform.OS, Arch: opts.Platform.Arch, + ARM: opts.Platform.GetARMVersion(), } if err := tpl.Execute(&outputPath, &tplData); err != nil { return err diff --git a/main.go b/main.go index 8b7d1de..fe7df24 100644 --- a/main.go +++ b/main.go @@ -31,9 +31,10 @@ func realMain() int { flags.Var(platformFlag.ArchFlagValue(), "arch", "arch to build for or skip") flags.Var(platformFlag.OSArchFlagValue(), "osarch", "os/arch pairs to build for or skip") flags.Var(platformFlag.OSFlagValue(), "os", "os to build for or skip") + flags.Var(platformFlag.ARMArchFlagValue(), "armarch", "os to build for or skip") flags.StringVar(&ldflags, "ldflags", "", "linker flags") flags.StringVar(&tags, "tags", "", "go build tags") - flags.StringVar(&outputTpl, "output", "{{.Dir}}_{{.OS}}_{{.Arch}}", "output path") + flags.StringVar(&outputTpl, "output", "{{.Dir}}_{{.OS}}_{{.Arch}}{{.ARM}}", "output path") flags.IntVar(¶llel, "parallel", -1, "parallelization factor") flags.BoolVar(&buildToolchain, "build-toolchain", false, "build toolchain") flags.BoolVar(&verbose, "verbose", false, "verbose") @@ -109,6 +110,12 @@ func realMain() int { return 1 } + fmt.Println("Building for platforms:") + for _, platform := range platforms { + fmt.Printf("%s\n", platform.String()) + } + fmt.Println("") + // Build in parallel! fmt.Printf("Number of parallel builds: %d\n\n", parallel) var errorLock sync.Mutex @@ -184,6 +191,7 @@ Options: -tags="" Additional '-tags' value to pass to go build -os="" Space-separated list of operating systems to build for -osarch="" Space-separated list of os/arch pairs to build for + -armarch="" Space-separated list of GOARM arch version to build for when arch is "arm" -osarch-list List supported os/arch pairs for your Go version -output="foo" Output path template. See below for more info -parallel=-1 Amount of parallelism, defaults to number of CPUs diff --git a/platform.go b/platform.go index 89401fc..cc6fd44 100644 --- a/platform.go +++ b/platform.go @@ -16,77 +16,98 @@ type Platform struct { // is not a default because it is quite rare that you're cross-compiling // something to Android AND something like Linux. Default bool + ARM string + + oldARMCompatibility bool } func (p *Platform) String() string { - return fmt.Sprintf("%s/%s", p.OS, p.Arch) + return fmt.Sprintf("%s/%s%s", p.OS, p.Arch, p.GetARMVersion()) +} + +func (p *Platform) GetARMVersion() string { + if len(p.ARM) > 0 { + return "v" + p.ARM + } + return "" } var ( OsList = []string{ "darwin", "dragonfly", - "freebsd", "linux", + "android", + "solaris", + "freebsd", + "nacl", "netbsd", "openbsd", "plan9", - "solaris", "windows", } ArchList = []string{ "386", "amd64", + "amd64p32", "arm", "arm64", + "mips64", + "mips64le", "ppc64", "ppc64le", } Platforms_1_0 = []Platform{ - {"darwin", "386", true}, - {"darwin", "amd64", true}, - {"linux", "386", true}, - {"linux", "amd64", true}, - {"linux", "arm", true}, - {"freebsd", "386", true}, - {"freebsd", "amd64", true}, - {"openbsd", "386", true}, - {"openbsd", "amd64", true}, - {"windows", "386", true}, - {"windows", "amd64", true}, + {OS: "darwin", Arch: "386", Default: true}, + {OS: "darwin", Arch: "amd64", Default: true}, + {OS: "linux", Arch: "386", Default: true}, + {OS: "linux", Arch: "amd64", Default: true}, + {OS: "linux", Arch: "arm", Default: true}, + {OS: "freebsd", Arch: "386", Default: true}, + {OS: "freebsd", Arch: "amd64", Default: true}, + {OS: "openbsd", Arch: "386", Default: true}, + {OS: "openbsd", Arch: "amd64", Default: true}, + {OS: "windows", Arch: "386", Default: true}, + {OS: "windows", Arch: "amd64", Default: true}, } Platforms_1_1 = append(Platforms_1_0, []Platform{ - {"freebsd", "arm", true}, - {"netbsd", "386", true}, - {"netbsd", "amd64", true}, - {"netbsd", "arm", true}, - {"plan9", "386", false}, + {OS: "freebsd", Arch: "arm", Default: true}, + {OS: "linux", Arch: "arm", Default: false, ARM: "5"}, + {OS: "linux", Arch: "arm", Default: false, ARM: "6"}, + {OS: "linux", Arch: "arm", Default: false, ARM: "7"}, + {OS: "netbsd", Arch: "386", Default: true}, + {OS: "netbsd", Arch: "amd64", Default: true}, + {OS: "netbsd", Arch: "arm", Default: true}, + {OS: "plan9", Arch: "386", Default: false}, }...) Platforms_1_3 = append(Platforms_1_1, []Platform{ - {"dragonfly", "386", false}, - {"dragonfly", "amd64", false}, - {"nacl", "amd64", false}, - {"nacl", "amd64p32", false}, - {"nacl", "arm", false}, - {"solaris", "amd64", false}, + {OS: "dragonfly", Arch: "386", Default: false}, + {OS: "dragonfly", Arch: "amd64", Default: false}, + {OS: "nacl", Arch: "amd64", Default: false}, + {OS: "nacl", Arch: "amd64p32", Default: false}, + {OS: "nacl", Arch: "arm", Default: false}, + {OS: "solaris", Arch: "amd64", Default: false}, }...) Platforms_1_4 = append(Platforms_1_3, []Platform{ - {"android", "arm", false}, - {"plan9", "amd64", false}, + {OS: "android", Arch: "arm", Default: false}, + {OS: "plan9", Arch: "amd64", Default: false}, }...) Platforms_1_5 = append(Platforms_1_4, []Platform{ - {"darwin", "arm", false}, - {"darwin", "arm64", false}, - {"linux", "arm64", false}, - {"linux", "ppc64", false}, - {"linux", "ppc64le", false}, + {OS: "darwin", Arch: "arm", Default: false}, + {OS: "darwin", Arch: "arm64", Default: false}, + {OS: "linux", Arch: "arm64", Default: false}, + {OS: "linux", Arch: "ppc64", Default: false}, + {OS: "linux", Arch: "ppc64le", Default: false}, }...) + + // Nothing changed from 1.5 to 1.6 + Platforms_1_6 = Platforms_1_5 ) // SupportedPlatforms returns the full list of supported platforms for @@ -102,8 +123,10 @@ func SupportedPlatforms(v string) []Platform { return Platforms_1_4 } else if strings.HasPrefix(v, "go1.5") { return Platforms_1_5 + } else if strings.HasPrefix(v, "go1.6") { + return Platforms_1_6 } // Assume latest - return Platforms_1_5 + return Platforms_1_6 } diff --git a/platform_flag.go b/platform_flag.go index d69d922..5290b28 100644 --- a/platform_flag.go +++ b/platform_flag.go @@ -9,9 +9,10 @@ import ( // PlatformFlag is a flag.Value (and flag.Getter) implementation that // is used to track the os/arch flags on the command-line. type PlatformFlag struct { - OS []string - Arch []string - OSArch []Platform + OS []string + Arch []string + OSArch []Platform + ARMArch []string } // Platforms returns the list of platforms that were set by this flag. @@ -80,7 +81,6 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform { if _, ok := includeArch[arch]; !ok { continue } - prefilter = append(prefilter, Platform{ OS: os, Arch: arch, @@ -106,19 +106,14 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform { // Remove any that aren't supported result := make([]Platform, 0, len(prefilter)) for _, pending := range prefilter { - found := false for _, platform := range supported { if pending.String() == platform.String() { - found = true + add := platform + add.Default = false + result = append(result, add) break } } - - if found { - add := pending - add.Default = false - result = append(result, add) - } } prefilter = result @@ -200,6 +195,12 @@ func (p *PlatformFlag) OSArchFlagValue() flag.Value { return (*appendPlatformValue)(&p.OSArch) } +// ARMArchFlagValue returns a flag.Value that can be used with the flag +// package to collect the arm arches for the flag. +func (p *PlatformFlag) ARMArchFlagValue() flag.Value { + return (*appendStringValue)(&p.ARMArch) +} + // appendPlatformValue is a flag.Value that appends a full platform (os/arch) // to a list where the values from space-separated lines. This is used to // satisfy the -osarch flag. diff --git a/platform_flag_test.go b/platform_flag_test.go index d89cc71..edba2ab 100644 --- a/platform_flag_test.go +++ b/platform_flag_test.go @@ -20,13 +20,13 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{"baz"}, []Platform{}, []Platform{ - {"foo", "baz", true}, - {"bar", "baz", true}, - {"boo", "bop", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "baz", Default: true}, + {OS: "boo", Arch: "bop", Default: true}, }, []Platform{ - {"foo", "baz", false}, - {"bar", "baz", false}, + {OS: "foo", Arch: "baz", Default: false}, + {OS: "bar", Arch: "baz", Default: false}, }, }, @@ -36,12 +36,12 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", true}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "bar", Default: true}, }, []Platform{ - {"bar", "bar", false}, + {OS: "bar", Arch: "bar", Default: false}, }, }, @@ -51,13 +51,13 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", true}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "bar", Default: true}, }, []Platform{ - {"foo", "bar", false}, - {"foo", "baz", false}, + {OS: "foo", Arch: "bar", Default: false}, + {OS: "foo", Arch: "baz", Default: false}, }, }, @@ -67,13 +67,13 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{"baz"}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "baz", true}, - {"baz", "bar", true}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "baz", Default: true}, + {OS: "baz", Arch: "bar", Default: true}, }, []Platform{ - {"bar", "baz", false}, + {OS: "bar", Arch: "baz", Default: false}, }, }, @@ -83,11 +83,11 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{"baz"}, []Platform{}, []Platform{ - {"foo", "baz", true}, - {"bar", "what", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "what", Default: true}, }, []Platform{ - {"foo", "baz", false}, + {OS: "foo", Arch: "baz", Default: false}, }, }, @@ -96,15 +96,15 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []string{}, []Platform{ - {"foo", "baz", true}, - {"foo", "bar", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "foo", Arch: "bar", Default: true}, }, []Platform{ - {"foo", "baz", true}, - {"bar", "what", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "what", Default: true}, }, []Platform{ - {"foo", "baz", false}, + {OS: "foo", Arch: "baz", Default: false}, }, }, @@ -113,14 +113,14 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []string{}, []Platform{ - {"!foo", "baz", true}, + {OS: "!foo", Arch: "baz", Default: true}, }, []Platform{ - {"foo", "baz", true}, - {"bar", "what", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "what", Default: true}, }, []Platform{ - {"bar", "what", false}, + {OS: "bar", Arch: "what", Default: false}, }, }, @@ -129,17 +129,17 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{"foo", "bar"}, []string{"bar"}, []Platform{ - {"foo", "baz", true}, - {"!bar", "bar", true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "!bar", Arch: "bar", Default: true}, }, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", true}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "bar", Arch: "bar", Default: true}, }, []Platform{ - {"foo", "baz", false}, - {"foo", "bar", false}, + {OS: "foo", Arch: "baz", Default: false}, + {OS: "foo", Arch: "bar", Default: false}, }, }, @@ -149,13 +149,13 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", false}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "!bar", Arch: "bar", Default: false}, }, []Platform{ - {"foo", "bar", false}, - {"foo", "baz", false}, + {OS: "foo", Arch: "bar", Default: false}, + {OS: "foo", Arch: "baz", Default: false}, }, }, @@ -165,12 +165,12 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", false}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "!bar", Arch: "bar", Default: false}, }, []Platform{ - {"bar", "bar", false}, + {OS: "!bar", Arch: "bar", Default: false}, }, }, @@ -180,12 +180,12 @@ func TestPlatformFlagPlatforms(t *testing.T) { []string{"bar"}, []Platform{}, []Platform{ - {"foo", "bar", true}, - {"foo", "baz", true}, - {"bar", "bar", false}, + {OS: "foo", Arch: "bar", Default: true}, + {OS: "foo", Arch: "baz", Default: true}, + {OS: "!bar", Arch: "bar", Default: false}, }, []Platform{ - {"bar", "bar", false}, + {OS: "!bar", Arch: "bar", Default: false}, }, }, } @@ -224,7 +224,7 @@ func TestPlatformFlagOSArchFlagValue(t *testing.T) { t.Fatalf("err: %s", err) } - expected := []Platform{{"foo", "bar", false}} + expected := []Platform{{OS: "foo", Arch: "bar", Default: false}} if !reflect.DeepEqual(f.OSArch, expected) { t.Fatalf("bad: %#v", f.OSArch) } @@ -271,8 +271,8 @@ func TestAppendPlatformValue(t *testing.T) { } expected := []Platform{ - {"windows", "arm", false}, - {"windows", "386", false}, + {OS: "windows", Arch: "arm", Default: false}, + {OS: "windows", Arch: "386", Default: false}, } if !reflect.DeepEqual([]Platform(value), expected) { t.Fatalf("bad: %#v", value) From 98589be439763f20c988e146f81be6c89b64b6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Guimar=C3=A3es?= Date: Wed, 27 Jul 2016 01:40:28 -0300 Subject: [PATCH 2/4] Tests fixed --- go_test.go | 2 +- platform.go | 2 -- platform_flag_test.go | 12 ++++++------ platform_test.go | 12 +++++++++++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/go_test.go b/go_test.go index a006f61..c2b1cfb 100644 --- a/go_test.go +++ b/go_test.go @@ -13,7 +13,7 @@ func TestGoVersion(t *testing.T) { acceptable := []string{ "devel", "go1.0", "go1.1", "go1.2", "go1.3", "go1.4.2", "go1.5", - "go1.5.1", + "go1.5.1", "go1.6", } found := false for _, expected := range acceptable { diff --git a/platform.go b/platform.go index cc6fd44..42072c1 100644 --- a/platform.go +++ b/platform.go @@ -17,8 +17,6 @@ type Platform struct { // something to Android AND something like Linux. Default bool ARM string - - oldARMCompatibility bool } func (p *Platform) String() string { diff --git a/platform_flag_test.go b/platform_flag_test.go index edba2ab..44c2739 100644 --- a/platform_flag_test.go +++ b/platform_flag_test.go @@ -167,10 +167,10 @@ func TestPlatformFlagPlatforms(t *testing.T) { []Platform{ {OS: "foo", Arch: "bar", Default: true}, {OS: "foo", Arch: "baz", Default: true}, - {OS: "!bar", Arch: "bar", Default: false}, + {OS: "bar", Arch: "bar", Default: false}, }, []Platform{ - {OS: "!bar", Arch: "bar", Default: false}, + {OS: "bar", Arch: "bar", Default: false}, }, }, @@ -182,15 +182,15 @@ func TestPlatformFlagPlatforms(t *testing.T) { []Platform{ {OS: "foo", Arch: "bar", Default: true}, {OS: "foo", Arch: "baz", Default: true}, - {OS: "!bar", Arch: "bar", Default: false}, + {OS: "bar", Arch: "bar", Default: false}, }, []Platform{ - {OS: "!bar", Arch: "bar", Default: false}, + {OS: "bar", Arch: "bar", Default: false}, }, }, } - for _, tc := range cases { + for i, tc := range cases { f := PlatformFlag{ OS: tc.OS, Arch: tc.Arch, @@ -199,7 +199,7 @@ func TestPlatformFlagPlatforms(t *testing.T) { result := f.Platforms(tc.Supported) if !reflect.DeepEqual(result, tc.Result) { - t.Errorf("input: %#v\nresult: %#v", f, result) + t.Errorf("Index: %d. input: %#v\nresult: %#v", i, f, result) } } } diff --git a/platform_test.go b/platform_test.go index 92d1747..40d5793 100644 --- a/platform_test.go +++ b/platform_test.go @@ -28,9 +28,19 @@ func TestSupportedPlatforms(t *testing.T) { t.Fatalf("bad: %#v", ps) } + ps = SupportedPlatforms("go1.5") + if !reflect.DeepEqual(ps, Platforms_1_5) { + t.Fatalf("bad: %#v", ps) + } + + ps = SupportedPlatforms("go1.6") + if !reflect.DeepEqual(ps, Platforms_1_6) { + t.Fatalf("bad: %#v", ps) + } + // Unknown ps = SupportedPlatforms("foo") - if !reflect.DeepEqual(ps, Platforms_1_4) { + if !reflect.DeepEqual(ps, Platforms_1_6) { t.Fatalf("bad: %#v", ps) } } From df7b3ccde251a52ea18a2878985a35a5ef4b786b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Guimar=C3=A3es?= Date: Wed, 27 Jul 2016 03:04:36 -0300 Subject: [PATCH 3/4] Finish --- go.go | 2 +- main.go | 2 +- platform.go | 20 +++++++++++++++++++- platform_flag.go | 9 +++------ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/go.go b/go.go index f8e1549..0858a60 100644 --- a/go.go +++ b/go.go @@ -65,7 +65,7 @@ func GoCrossCompile(opts *CompileOpts) error { tplData := OutputTemplateData{ Dir: filepath.Base(opts.PackagePath), OS: opts.Platform.OS, - Arch: opts.Platform.Arch, + Arch: opts.Platform.GetArch(), ARM: opts.Platform.GetARMVersion(), } if err := tpl.Execute(&outputPath, &tplData); err != nil { diff --git a/main.go b/main.go index fe7df24..34d7e42 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func realMain() int { flags.Var(platformFlag.ARMArchFlagValue(), "armarch", "os to build for or skip") flags.StringVar(&ldflags, "ldflags", "", "linker flags") flags.StringVar(&tags, "tags", "", "go build tags") - flags.StringVar(&outputTpl, "output", "{{.Dir}}_{{.OS}}_{{.Arch}}{{.ARM}}", "output path") + flags.StringVar(&outputTpl, "output", "{{.Dir}}_{{.OS}}_{{.Arch}}", "output path") flags.IntVar(¶llel, "parallel", -1, "parallelization factor") flags.BoolVar(&buildToolchain, "build-toolchain", false, "build toolchain") flags.BoolVar(&verbose, "verbose", false, "verbose") diff --git a/platform.go b/platform.go index 42072c1..0625323 100644 --- a/platform.go +++ b/platform.go @@ -19,8 +19,26 @@ type Platform struct { ARM string } +func PlatformFromString(os, arch string) Platform { + if strings.HasPrefix(arch, "arm") && len(arch) >= 5 { + return Platform{ + OS: os, + Arch: "arm", + ARM: arch[4:], + } + } + return Platform{ + OS: os, + Arch: arch, + } +} + func (p *Platform) String() string { - return fmt.Sprintf("%s/%s%s", p.OS, p.Arch, p.GetARMVersion()) + return fmt.Sprintf("%s/%s", p.OS, p.GetArch()) +} + +func (p *Platform) GetArch() string { + return fmt.Sprintf("%s%s", p.Arch, p.GetARMVersion()) } func (p *Platform) GetARMVersion() string { diff --git a/platform_flag.go b/platform_flag.go index 5290b28..56ff04a 100644 --- a/platform_flag.go +++ b/platform_flag.go @@ -81,10 +81,7 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform { if _, ok := includeArch[arch]; !ok { continue } - prefilter = append(prefilter, Platform{ - OS: os, - Arch: arch, - }) + prefilter = append(prefilter, PlatformFromString(os, arch)) } } } else if len(includeOS) > 0 { @@ -150,7 +147,7 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform { if checkComponents { if len(ignoreArch) > 0 { - if _, ok := ignoreArch[platform.Arch]; ok { + if _, ok := ignoreArch[platform.GetArch()]; ok { continue } } @@ -160,7 +157,7 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform { } } if len(includeArch) > 0 { - if _, ok := includeArch[platform.Arch]; !ok { + if _, ok := includeArch[platform.GetArch()]; !ok { continue } } From dc50315fc7992f4fa34a4ee4bb3d60052eeb038e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Guimar=C3=A3es?= Date: Wed, 27 Jul 2016 11:58:39 -0300 Subject: [PATCH 4/4] Fix a bug with arm64 --- platform.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.go b/platform.go index 0625323..9353b09 100644 --- a/platform.go +++ b/platform.go @@ -20,7 +20,7 @@ type Platform struct { } func PlatformFromString(os, arch string) Platform { - if strings.HasPrefix(arch, "arm") && len(arch) >= 5 { + if strings.HasPrefix(arch, "armv") && len(arch) >= 5 { return Platform{ OS: os, Arch: "arm",