10 _ "github.com/anacrolix/envpprof"
13 type StatusWriter interface {
14 WriteStatus(io.Writer)
17 // The key is the route pattern. The value is nil when the resource is released.
20 sws = map[string]StatusWriter{}
23 func ExportStatusWriter(sw StatusWriter, path string, t testing.TB) (release func()) {
24 pattern := fmt.Sprintf("/%s/%s", t.Name(), path)
25 t.Logf("exporting status path %q", pattern)
33 if curSw, ok := sws[pattern]; ok {
35 panic(fmt.Sprintf("%q still in use", pattern))
42 func(w http.ResponseWriter, r *http.Request) {