From f964810025ae58b623798a1944c39c06266fb45d Mon Sep 17 00:00:00 2001 From: Jaana Burcu Dogan Date: Mon, 19 Sep 2016 20:36:45 -0700 Subject: [PATCH] net/http/httptrace: fix bad tracing example Tracing happens at the http.Trace level. Fix the example to demostrate tracing in the lifecycle of a RoundTrip. Updates #17152. Change-Id: Ic7d7bcc550176189206185482e8962dbf1504ff1 Reviewed-on: https://go-review.googlesource.com/29431 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/net/http/httptrace/example_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/net/http/httptrace/example_test.go b/src/net/http/httptrace/example_test.go index 3a4b35469c..07fdc0a472 100644 --- a/src/net/http/httptrace/example_test.go +++ b/src/net/http/httptrace/example_test.go @@ -6,6 +6,7 @@ package httptrace_test import ( "fmt" + "log" "net/http" "net/http/httptrace" ) @@ -21,5 +22,8 @@ func Example() { }, } req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace)) - http.DefaultClient.Do(req) + _, err := http.DefaultTransport.RoundTrip(req) + if err != nil { + log.Fatal(err) + } } -- 2.48.1