Specify timeout when tracing HTTP request in Go
问题 I know the usual method of specifying a timeout with HTTP requests by doing: httpClient := http.Client{ Timeout: time.Duration(5 * time.Second), } However, I can't seem to figure out how to do the same when tracing HTTP requests. Here is the piece of code I am working with: func timeGet(url string) (httpTimingBreakDown, error) { req, _ := http.NewRequest("GET", url, nil) var start, connect, dns, tlsHandshake time.Time var timingData httpTimingBreakDown timingData.url = url trace := &httptrace