Commit bf141a18 authored by Hana Kim's avatar Hana Kim Committed by Hyang-Ah Hana Kim

cmd/go/internal/web2: log http requests with -v

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: 's avatarBryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent a35ddcc2
...@@ -7,11 +7,13 @@ package web2 ...@@ -7,11 +7,13 @@ package web2
import ( import (
"bytes" "bytes"
"cmd/go/internal/base" "cmd/go/internal/base"
"cmd/go/internal/cfg"
"encoding/json" "encoding/json"
"flag" "flag"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
...@@ -187,10 +189,10 @@ func SetHTTPDoForTesting(do func(*http.Request) (*http.Response, error)) { ...@@ -187,10 +189,10 @@ func SetHTTPDoForTesting(do func(*http.Request) (*http.Response, error)) {
} }
func Get(url string, options ...Option) error { func Get(url string, options ...Option) error {
if TraceGET || webstack { if TraceGET || webstack || cfg.BuildV {
println("GET", url) log.Printf("Fetching %s", url)
if webstack { if webstack {
println(string(debug.Stack())) log.Println(string(debug.Stack()))
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment