]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/web2: log http requests with -v
authorHana Kim <hyangah@gmail.com>
Tue, 11 Dec 2018 23:06:50 +0000 (18:06 -0500)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Wed, 12 Dec 2018 22:33:24 +0000 (22:33 +0000)
It's similar to what cmd/go/internal/web package does
when cfg.BuildV is set. The web2 package is what
cmd/go/internal/modfetch uses, so this change allows us
to trace web requests go get command in module mode
sends for modfetch.

Change-Id: If387efd8a8698c816bf267d1e6c6766fd357c298
Reviewed-on: https://go-review.googlesource.com/c/153640
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/internal/web2/web.go

index f3900379e1784fd8774d0902872864e513b2f874..64934f1d506dbfa4142550a57656a8816dec75c4 100644 (file)
@@ -7,11 +7,13 @@ package web2
 import (
        "bytes"
        "cmd/go/internal/base"
+       "cmd/go/internal/cfg"
        "encoding/json"
        "flag"
        "fmt"
        "io"
        "io/ioutil"
+       "log"
        "net/http"
        "os"
        "path/filepath"
@@ -187,10 +189,10 @@ func SetHTTPDoForTesting(do func(*http.Request) (*http.Response, error)) {
 }
 
 func Get(url string, options ...Option) error {
-       if TraceGET || webstack {
-               println("GET", url)
+       if TraceGET || webstack || cfg.BuildV {
+               log.Printf("Fetching %s", url)
                if webstack {
-                       println(string(debug.Stack()))
+                       log.Println(string(debug.Stack()))
                }
        }