mirror of
https://github.com/golang/go
synced 2024-11-26 07:47:57 -07:00
cmd/go: use builtin version and reexec for env
Skip execing for version (most reliable) and attempt to reexec for env, falling back to the go in GOROOT Fixes #43981 Change-Id: I17fb84d36036807274eecca3d4f64b3add9b9483 Reviewed-on: https://go-review.googlesource.com/c/go/+/288693 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
d2f96f2f75
commit
c3e2ed711c
@ -81,7 +81,7 @@ func printGoVersion(w io.Writer) {
|
||||
fmt.Fprintf(w, "### What version of Go are you using (`go version`)?\n\n")
|
||||
fmt.Fprintf(w, "<pre>\n")
|
||||
fmt.Fprintf(w, "$ go version\n")
|
||||
printCmdOut(w, "", "go", "version")
|
||||
fmt.Fprintf(w, "go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Fprintf(w, "</pre>\n")
|
||||
fmt.Fprintf(w, "\n")
|
||||
}
|
||||
@ -90,7 +90,11 @@ func printEnvDetails(w io.Writer) {
|
||||
fmt.Fprintf(w, "### What operating system and processor architecture are you using (`go env`)?\n\n")
|
||||
fmt.Fprintf(w, "<details><summary><code>go env</code> Output</summary><br><pre>\n")
|
||||
fmt.Fprintf(w, "$ go env\n")
|
||||
printCmdOut(w, "", "go", "env")
|
||||
goexe, err := os.Executable()
|
||||
if err != nil {
|
||||
goexe = filepath.Join(runtime.GOROOT(), "bin/go")
|
||||
}
|
||||
printCmdOut(w, "", goexe, "env")
|
||||
printGoDetails(w)
|
||||
printOSDetails(w)
|
||||
printCDetails(w)
|
||||
|
14
src/cmd/go/testdata/script/bug.txt
vendored
14
src/cmd/go/testdata/script/bug.txt
vendored
@ -1,9 +1,11 @@
|
||||
# Verify that go bug creates the appropriate URL issue body
|
||||
|
||||
[!linux] skip
|
||||
[short] skip
|
||||
|
||||
go install
|
||||
env BROWSER=$GOPATH/bin/browser
|
||||
go build -o $TMPDIR/go ./go
|
||||
env BROWSER=$GOPATH/bin/browser PATH=$TMPDIR:$PATH
|
||||
go bug
|
||||
exists $TMPDIR/browser
|
||||
grep '^go version' $TMPDIR/browser
|
||||
@ -44,3 +46,13 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
-- go/main.go --
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user