1
0
mirror of https://github.com/golang/go synced 2024-11-20 07:54:39 -07:00

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
This commit is contained in:
Amir Mohammad Saied 2012-06-30 12:27:57 -07:00 committed by Brad Fitzpatrick
parent f06b12f0c7
commit 35030a9966

View File

@ -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) {