ref: b1a6f7815ce3a1957a2d2374eeb085f158f576e5
dir: /main.go/
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The gover command compiles and runs the go command from a release version. // // To install, run: // // $ go get suah.dev/gover // $ gover download 1.14.2 // // And then use the gover command as if it were your normal go command. // // To download a specific version, run "gover download VERSION". package main import ( "bytes" "errors" "fmt" "io" "log" "net/http" "os" "os/exec" "os/user" "path" "path/filepath" "runtime" "strings" "golang.org/x/crypto/openpgp" ) // Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com> // RSA key 0x78BD65473CB3BD13 // Primary key fingerprint: EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796 // Subkey fingerprint: 2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13 const pubKey = `-----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFcMjNMBEAC6Wr5QuLIFgz1V1EFPlg8ty2TsjQEl4VWftUAqWlMevJFWvYEx BOsOZ6kNFfBfjAxgJNWTkxZrHzDl74R7KW/nUx6X57bpFjUyRaB8F3/NpWKSeIGS pJT+0m2SgUNhLAn1WY/iNJGNaMl7lgUnaP+/ZsSNT9hyTBiH3Ev5VvAtMGhVI/u8 P0EtTjXp4o2U+VqFTBGmZ6PJVhCFjZUeRByloHw8dGOshfXKgriebpioHvU8iQ2U GV3WNIirB2Rq1wkKxXJ/9Iw+4l5m4GmXMs7n3XaYQoBj28H86YA1cYWSm5LR5iU2 TneI1fJ3vwF2vpSXVBUUDk67PZhg6ZwGRT7GFWskC0z8PsWd5jwK20mA8EVKq0vN BFmMK6i4fJU+ux17Rgvnc9tDSCzFZ1/4f43EZ41uTmmNXIDsaPCqwjvSS5ICadt2 xeqTWDlzONUpOs5yBjF1cfJSdVxsfshvln2JXUwgIdKl4DLbZybuNFXnPffNLb2v PtRJHO48O2UbeXS8n27PcuMoLRd7+r7TsqG2vBH4t/cB/1vsvWMbqnQlaJ5VsjeW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vPCE3OfG+11xp6oiNMRVsR5pTu7RiI1BQAyICWUW/wXuhhHkkwNTiwfciJfVA8 ckOiRubik8geEH5boOxgeAaBu6yusQVHnRRyG4wjQ+qsWo+wDI9WMdtpNG1toJrS UL4OYa4oX3YogSv5hGrbYIaP4HwO6O2oTMnS0lRIGJOqbEQcmKUa/nWT/3NipTnY zyMjMlEQe89YKjd+32tjMfOSdIOvwCGaTizdWnKPF77qB9D0v8C/7AdHmEFqf2ZX 8vK31aaY+ZpPWG5IHlf6f/buIMBalJOxIBeveBqxcHwQ =kkJT -----END PGP PUBLIC KEY BLOCK----- ` func main() { log.SetFlags(0) root, err := goroot("gover") version := "" if err != nil { log.Fatalf("gover: %v", err) } pledge("stdio tty unveil rpath cpath wpath proc dns inet fattr exec") unveil("/etc", "r") unveil(root, "rwxc") unveilBlock() if os.Args[1] == "download" { switch len(os.Args) { case 3: version = os.Args[2] if err := installVer(root, version); err != nil { log.Fatalf("gover: %v", err) } default: log.Fatalf("gover: usage: gover download [version]") } log.Printf("Success. You may now run 'gover %s'!", version) os.Exit(0) } version = os.Args[1] gobin := filepath.Join(root, version, "go", "bin", "go"+exe()) gorootPath := filepath.Join(root, version, "go") if _, err := os.Stat(gobin); err != nil { log.Fatalf("gover: not downloaded. Run 'gover download' to install to %v", root) } cmd := exec.Command(gobin, os.Args[2:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr newPath := filepath.Join(root, version, "go", "bin") if p := os.Getenv("PATH"); p != "" { newPath += string(filepath.ListSeparator) + p } cmd.Env = dedupEnv(caseInsensitiveEnv, append(os.Environ(), "GOROOT="+gorootPath, "PATH="+newPath)) if err := cmd.Run(); err != nil { if _, ok := err.(*exec.ExitError); ok { // TODO: return the same exit status maybe. os.Exit(1) } log.Fatalf("gover: failed to execute %v: %v", gobin, err) } os.Exit(0) } func fetch(a, b string) (*os.File, error) { fmt.Printf("Fetching %q\n", a) f, err := os.Create(b) if err != nil { return nil, err } fResp, err := http.Get(a) if err != nil { return nil, err } defer fResp.Body.Close() if _, err := io.Copy(f, fResp.Body); err != nil { return nil, err } _, err = f.Seek(0, 0) if err != nil { return nil, err } return f, nil } func fetchify(goURL string, fp string) error { buf := bytes.NewBufferString(pubKey) kr, err := openpgp.ReadArmoredKeyRing(buf) if err != nil { return err } tbz, err := fetch(goURL, fp) if err != nil { return err } sig, err := fetch(goURL+".asc", fp+".asc") if err != nil { return err } defer tbz.Close() defer sig.Close() _, err = openpgp.CheckArmoredDetachedSignature(kr, tbz, sig) if err != nil { return err } fmt.Println("Signature OK.") _, err = tbz.Seek(0, 0) if err != nil { return err } return Untar(tbz, path.Dir(fp)) } func installVer(root, version string) error { goURL := fmt.Sprintf("https://dl.google.com/go/go%s.src.tar.gz", version) goFP := filepath.Join(root, version, fmt.Sprintf("go%s.src.tar.gz", version)) if _, err := os.Stat(filepath.Join(root, version, "go")); err != nil { if err := os.MkdirAll(filepath.Join(root, version), 0755); err != nil { return fmt.Errorf("failed to create source directory: %v", err) } err := fetchify(goURL, goFP) if err != nil { return fmt.Errorf("failed to verify: %v", err) } } cmd := exec.Command(filepath.Join(root, version, "go", "src", makeScript())) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.Dir = filepath.Join(root, version, "go", "src") if runtime.GOOS == "windows" { // Workaround make.bat not autodetecting GOROOT_BOOTSTRAP. Issue 28641. goroot, err := exec.Command("go", "env", "GOROOT").Output() if err != nil { return fmt.Errorf("failed to detect an existing go installation for bootstrap: %v", err) } cmd.Env = append(os.Environ(), "GOROOT_BOOTSTRAP="+strings.TrimSpace(string(goroot))) } if err := cmd.Run(); err != nil { return fmt.Errorf("failed to build go: %v", err) } return nil } func makeScript() string { switch runtime.GOOS { case "plan9": return "make.rc" case "windows": return "make.bat" default: return "make.bash" } } const caseInsensitiveEnv = runtime.GOOS == "windows" func exe() string { if runtime.GOOS == "windows" { return ".exe" } return "" } func goroot(version string) (string, error) { home, err := homedir() if err != nil { return "", fmt.Errorf("failed to get home directory: %v", err) } return filepath.Join(home, "sdk", version), nil } func homedir() (string, error) { // This could be replaced with os.UserHomeDir, but it was introduced too // recently, and we want this to work with go as packaged by Linux // distributions. Note that user.Current is not enough as it does not // prioritize $HOME. See also Issue 26463. switch runtime.GOOS { case "plan9": if dir := os.Getenv("home"); dir != "" { return dir, nil } return "", errors.New("can't find user home directory; %USERPROFILE% is empty") case "windows": if dir := os.Getenv("USERPROFILE"); dir != "" { return dir, nil } return "", errors.New("can't find user home directory; %USERPROFILE% is empty") default: if dir := os.Getenv("HOME"); dir != "" { return dir, nil } if u, err := user.Current(); err == nil && u.HomeDir != "" { return u.HomeDir, nil } return "", errors.New("can't find user home directory; $HOME is empty") } } // dedupEnv returns a copy of env with any duplicates removed, in favor of // later values. // Items are expected to be on the normal environment "key=value" form. // If caseInsensitive is true, the case of keys is ignored. // // This function is unnecessary when the binary is // built with Go 1.9+, but keep it around for now until Go 1.8 // is no longer seen in the wild in common distros. // // This is copied verbatim from golang.org/x/build/envutil.Dedup at CL 10301 // (commit a91ae26). func dedupEnv(caseInsensitive bool, env []string) []string { out := make([]string, 0, len(env)) saw := map[string]int{} // to index in the array for _, kv := range env { eq := strings.Index(kv, "=") if eq < 1 { out = append(out, kv) continue } k := kv[:eq] if caseInsensitive { k = strings.ToLower(k) } if dupIdx, isDup := saw[k]; isDup { out[dupIdx] = kv } else { saw[k] = len(out) out = append(out, kv) } } return out }