go-chi / docgen

auto-generate routing documentation in JSON or Markdown for a `chi` Router from your app source
MIT License
111 stars 24 forks source link

RAML Test fails with chi Profiler middleware. #3

Open zbindenren opened 7 years ago

zbindenren commented 7 years ago

If I add the the profiler in the raml test here like:

...
r.Get("/panic", func(w http.ResponseWriter, r *http.Request) {                                                                                                                 
    panic("test")
})  
r.Mount("/debug", middleware.Profiler()) //<- this is new
r.Route("/articles", func(r chi.Router) { 
...

the test panics:

--- FAIL: TestWalkerRAML (0.01s)
panic: reflect: call of reflect.Value.Pointer on string Value [recovered]
        panic: reflect: call of reflect.Value.Pointer on string Value

goroutine 6 [running]:
testing.tRunner.func1(0xc4201380f0)
        /home/rz/.gimme/versions/go1.9.linux.amd64/src/testing/testing.go:711 +0x2d2
panic(0x7d7a20, 0xc4203baec0)
        /home/rz/.gimme/versions/go1.9.linux.amd64/src/runtime/panic.go:491 +0x283
reflect.Value.Pointer(0x7d3420, 0xc420010e20, 0x98, 0xc420010e20)
        /home/rz/.gimme/versions/go1.9.linux.amd64/src/reflect/value.go:1276 +0x185
git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen.getCallerFrame(0x7d3420, 0xc420010e20, 0xc42023dd70)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/funcinfo.go:70 +0x6f
git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen.GetFuncInfo(0x7d3420, 0xc420010e20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/funcinfo.go:25 +0x91
git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/raml_test.TestWalkerRAML.func1(0x8526cc, 0x4, 0xc4203b21c0, 0x14, 0xa582c0, 0xc420010e20, 0xc4203b6d20, 0x4, 0x6, 0x0, ...)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/raml/raml_test.go:30 +0x5f
git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi.walk(0xa59240, 0xc42008d1f0, 0xc420010f80, 0xc42001a9b8, 0x8, 0xc420240000, 0x3, 0x4, 0x0, 0x0)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi/tree.go:798 +0x397
git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi.walk(0xa59240, 0xc42008d180, 0xc420010f80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x870200, 0xa59240)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi/tree.go:779 +0x6a9
git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi.Walk(0xa59240, 0xc42008d180, 0xc420010f80, 0xa59240, 0xc42008d180)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/chi/tree.go:769 +0x6c
git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/raml_test.TestWalkerRAML(0xc4201380f0)
        /home/rz/golang/src/git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/raml/raml_test.go:29 +0x16c
testing.tRunner(0xc4201380f0, 0x8702e0)
        /home/rz/.gimme/versions/go1.9.linux.amd64/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
        /home/rz/.gimme/versions/go1.9.linux.amd64/src/testing/testing.go:789 +0x2de
exit status 2
FAIL    git.pnet.ch/mule/mule/vendor/github.com/go-chi/docgen/raml      0.021s
rdelaage commented 1 year ago

Any update? I have the same problem here...