gotip: don't set User-Agent for http.DefaultTransport
This code was copied from ./internal/version in CL 206537 with the
intention of making the gotip command more consistent with the other
golang.org/dl/go... commands. However, the gotip command does not
use net/http at all, so setting a custom user agent has no effect.
Change-Id: I1632aa5f01d9c1a2541219d2649d7dc57ac259b5
Reviewed-on: https://go-review.googlesource.com/c/dl/+/207097
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/gotip/main.go b/gotip/main.go
index bad0210..6338234 100644
--- a/gotip/main.go
+++ b/gotip/main.go
@@ -18,7 +18,6 @@
"errors"
"fmt"
"log"
- "net/http"
"os"
"os/exec"
"os/user"
@@ -27,10 +26,6 @@
"strings"
)
-func init() {
- http.DefaultTransport = &userAgentTransport{http.DefaultTransport}
-}
-
func main() {
log.SetFlags(0)
@@ -186,15 +181,6 @@
}
}
-type userAgentTransport struct {
- rt http.RoundTripper
-}
-
-func (uat userAgentTransport) RoundTrip(r *http.Request) (*http.Response, error) {
- r.Header.Set("User-Agent", "golang-x-build-version/devel")
- return uat.rt.RoundTrip(r)
-}
-
// dedupEnv returns a copy of env with any duplicates removed, in favor of
// later values.
// Items are expected to be on the normal environment "key=value" form.