-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Seems similar to #18 but still happens with current version:
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/sanity-io/litter"
)
func main() {
r := mux.NewRouter()
r.HandleFunc(`/foo`, AnyHandler).Name("named")
r.HandleFunc("/", AnyHandler).Name("front")
srv := &http.Server{
Handler: r,
Addr: "127.0.0.1:8000",
}
log.Fatal(srv.ListenAndServe())
}
func AnyHandler(w http.ResponseWriter, r *http.Request) {
route := mux.CurrentRoute(r)
litter.Config.HidePrivateFields = false
fmt.Fprintln(w, route.GetName())
defer func() {
p := recover()
if p != nil {
fmt.Printf("Recovered: %#v\n", p)
}
}()
litter.Sdump(route)
}- Navigate to either
/or/foo - Panics with:
"reflect.Value.Interface: cannot return value obtained from unexported field or method" - Does not panic if only one of the routes is handled
- Does not panic if either of the routes is not named
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels