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
expvar: avoid conflict 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/vars" declared in the expvar package.
You get an error such as:
panic: pattern "GET /" (registered at ...) conflicts with pattern
"/debug/vars" (registered at ...expvar.go:384):
GET / matches fewer methods than /debug/vars, but has a more general path
pattern
This patch prevents that error. Adding GET is correct because no other
method makes sense with /debug/vars. However, a tool using any other
methods will break.
We preserve the traditional behaviour when GODEBUG=httpmuxgo121=1 is
specified.
Fixes#65723
0 commit comments