()
| 12 | ) |
| 13 | |
| 14 | func Example_http() { |
| 15 | tp := &http.Transport{Dial: rateLimitDialer} |
| 16 | client := &http.Client{Transport: tp} |
| 17 | ps := &PackageStore{ |
| 18 | client: client, |
| 19 | } |
| 20 | |
| 21 | _, err := ps.Get() |
| 22 | fmt.Printf("Error fetching packages: %+v\n", tracetest.MustClean(errtrace.FormatString(err))) |
| 23 | // Output: |
| 24 | // Error fetching packages: Get "http://example.com/packages.index": connect rate limited |
| 25 | // |
| 26 | // braces.dev/errtrace_test.rateLimitDialer |
| 27 | // /path/to/errtrace/example_http_test.go:3 |
| 28 | // braces.dev/errtrace_test.(*PackageStore).updateIndex |
| 29 | // /path/to/errtrace/example_http_test.go:2 |
| 30 | // braces.dev/errtrace_test.(*PackageStore).Get |
| 31 | // /path/to/errtrace/example_http_test.go:1 |
| 32 | } |
| 33 | |
| 34 | type PackageStore struct { |
| 35 | client *http.Client |
nothing calls this directly
no test coverage detected