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.
17 // arch contains either amd64 or 386.
18 var arch = func() string {
19 cmd := exec.Command("uname", "-m") // "x86_64"
20 if runtime.GOOS == "windows" {
21 cmd = exec.Command("powershell", "-command", "(Get-WmiObject -Class Win32_ComputerSystem).SystemType") // "x64-based PC"
24 out, err := cmd.Output()
26 // a sensible default?
29 if bytes.Contains(out, []byte("64")) {
35 func findGo(ctx context.Context, cmd string) (string, error) {
36 out, err := exec.CommandContext(ctx, cmd, "go").CombinedOutput()
37 return strings.TrimSpace(string(out)), err