You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
net/http/pprof: avoid panic with user-defined "GET /" route
With the new routing style in go 1.22, declaring
http.Handle("GET /", h)
generates a conflict with route "/debug/pprof/" and the others declared in
the net/http/pprof package. You get an error such as:
panic: pattern "GET /" (registered at .../pprof.go:94): GET / matches
fewer methods than /debug/pprof/, but has a more general path pattern
This patch prevents that error. Adding GET is correct because no other
method makes sense with the /debug/pprof routes. However, a tool using any
method other than GET will break.
We preserve the traditional behaviour when GODEBUG=httpmuxgo121=1 is
specified.
Updates #65723
Change-Id: I49c21f5f3e802ad7538062d824354b2e4d8a800e
GitHub-Last-Rev: 35e4012
GitHub-Pull-Request: #65791
Reviewed-on: https://go-review.googlesource.com/c/go/+/565176
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
0 commit comments