File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,10 @@ type deltaProfiler interface {
21
21
}
22
22
23
23
func init () {
24
- http .HandleFunc ("/debug/pprof/delta_heap" , Heap )
25
- http .HandleFunc ("/debug/pprof/delta_block" , Block )
26
- http .HandleFunc ("/debug/pprof/delta_mutex" , Mutex )
24
+ prefix := routePrefix ()
25
+ http .HandleFunc (prefix + "/debug/pprof/delta_heap" , Heap )
26
+ http .HandleFunc (prefix + "/debug/pprof/delta_block" , Block )
27
+ http .HandleFunc (prefix + "/debug/pprof/delta_mutex" , Mutex )
27
28
}
28
29
29
30
func Heap (w http.ResponseWriter , r * http.Request ) {
Original file line number Diff line number Diff line change
1
+ //go:build !go1.22
2
+
3
+ package pprof
4
+
5
+ func routePrefix () string {
6
+ return ""
7
+ }
Original file line number Diff line number Diff line change
1
+ //go:build go1.22
2
+
3
+ package pprof
4
+
5
+ func routePrefix () string {
6
+ // As of go 1.23 we will panic if we don't prefix with "GET "
7
+ // https://github.com/golang/go/blob/9fcffc53593c5cd103630d0d24ef8bd91e17246d/src/net/http/pprof/pprof.go#L98-L97
8
+ // https://github.com/golang/go/commit/9fcffc53593c5cd103630d0d24ef8bd91e17246d
9
+ return "GET "
10
+ }
You can’t perform that action at this time.
0 commit comments