From 731bbfef3ba6c7ab6b43dd2d08fbd5e1373d3f6c Mon Sep 17 00:00:00 2001 From: Amir Mohammad Saied Date: Sat, 22 Sep 2012 05:53:56 +1000 Subject: [PATCH] [release-branch.go1] cmd/go: httpGet function does not use global variable httpClient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ««« backport 650544a058e9 cmd/go: httpGet function does not use global variable httpClient No change, just for consistency. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6346048 »»» --- src/cmd/go/http.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/go/http.go b/src/cmd/go/http.go index 6de9a3e1e4..107b820f28 100644 --- a/src/cmd/go/http.go +++ b/src/cmd/go/http.go @@ -20,9 +20,13 @@ import ( "net/url" ) +// httpClient is the default HTTP client, but a variable so it can be +// changed by tests, without modifying http.DefaultClient. +var httpClient = http.DefaultClient + // httpGET returns the data from an HTTP GET request for the given URL. func httpGET(url string) ([]byte, error) { - resp, err := http.Get(url) + resp, err := httpClient.Get(url) if err != nil { return nil, err } @@ -37,10 +41,6 @@ func httpGET(url string) ([]byte, error) { return b, nil } -// httpClient is the default HTTP client, but a variable so it can be -// changed by tests, without modifying http.DefaultClient. -var httpClient = http.DefaultClient - // httpsOrHTTP returns the body of either the importPath's // https resource or, if unavailable, the http resource. func httpsOrHTTP(importPath string) (urlStr string, body io.ReadCloser, err error) {