]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: use httpGET helper in bug command
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 5 Sep 2016 18:14:55 +0000 (15:14 -0300)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 5 Sep 2016 19:23:26 +0000 (19:23 +0000)
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 <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/bug.go

index 975c1cc8a81c3839cb234dc32e44b33c31f5f9c4..7cf39ecd845e2490243bfeea9ef2d67fca23e44f 100644 (file)
@@ -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 {