From: Caio Marcelo de Oliveira Filho Date: Mon, 5 Sep 2016 18:14:55 +0000 (-0300) Subject: cmd/go: use httpGET helper in bug command X-Git-Tag: go1.8beta1~1491 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=29272b1e611bf20b706e26757e5d0d872e61adff;p=gostls13.git cmd/go: use httpGET helper in bug command Use existing helper function instead of importing "net/http". This allows the go_bootstrap build to not depend on "net/http" package. See cmd/go/http.go for details. Fixes build bootstrap build with all.bash. Change-Id: I2fd0fb01af7774f1690a353af22137680ec78170 Reviewed-on: https://go-review.googlesource.com/28531 Reviewed-by: Josh Bleecher Snyder Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/go/bug.go b/src/cmd/go/bug.go index 975c1cc8a8..7cf39ecd84 100644 --- a/src/cmd/go/bug.go +++ b/src/cmd/go/bug.go @@ -8,7 +8,6 @@ import ( "bytes" "fmt" "io/ioutil" - "net/http" "os/exec" "runtime" "strings" @@ -83,15 +82,7 @@ func printCDetails() { } func inspectGoVersion() { - resp, err := http.Get("https://golang.org/VERSION?m=text") - if err != nil { - if buildV { - fmt.Printf("failed to GET golang.org/VERSION: %v\n", err) - } - return - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + data, err := httpGET("https://golang.org/VERSION?m=text") if err != nil { if buildV { fmt.Printf("failed to read from golang.org/VERSION: %v\n", err) @@ -102,7 +93,7 @@ func inspectGoVersion() { // golang.org/VERSION currently returns a whitespace-free string, // but just in case, protect against that changing. // Similarly so for runtime.Version. - release := string(bytes.TrimSpace(body)) + release := string(bytes.TrimSpace(data)) vers := strings.TrimSpace(runtime.Version()) if vers == release {