1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 exec "golang.org/x/sys/execabs"
18 // arch contains either amd64 or 386.
19 var arch = func() string {
20 cmd := exec.Command("uname", "-m") // "x86_64"
21 if runtime.GOOS == "windows" {
22 cmd = exec.Command("powershell", "-command", "(Get-WmiObject -Class Win32_ComputerSystem).SystemType") // "x64-based PC"
25 out, err := cmd.Output()
27 // a sensible default?
30 if bytes.Contains(out, []byte("64")) {
36 func findGo(ctx context.Context, cmd string) (string, error) {
37 out, err := exec.CommandContext(ctx, cmd, "go").CombinedOutput()
38 return strings.TrimSpace(string(out)), err