Skip to content

PANIC Value not found for type *web.Context #2

@xyproto

Description

@xyproto

Hi,

The "martini" branch in one of my repositories has an example application that panics when visited, that did not panic with hoisie/web:

https://github.com/xyproto/browserspeak/tree/martini

One way of trying it out

go get github.com/martini-contrib/web
go get github.com/go-martini/martini
mkdir -p $GOPATH/src/github.com/xyproto
cd $GOPATH/src/github.com/xyproto
git clone https://github.com/xyproto/browserspeak.git -b martini
cd browserspeak/example
go build
PORT=8080 ./example

Visiting http://localhost:8080/test.svg works, but http://localhost:8080/ gives the following backtrace:

PANIC

Value not found for type *web.Context

/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/router.go:352 (0x43dd08)
    (*routeContext).run: panic(err)
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/router.go:229 (0x43d102)
    (*route).Handle: context.run()
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/router.go:112 (0x43c13c)
    (*router).Handle: route.Handle(context, res)
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:111 (0x43e5d0)
    Router.Handle.fm: m.Action(r.Handle)
/opt/go/src/pkg/runtime/asm_amd64.s:340 (0x4242b2)
    call64: CALLFN(call64, 64)
/opt/go/src/pkg/reflect/value.go:474 (0x464fbb)
    Value.call: call(fn, ptr, uint32(size))
/opt/go/src/pkg/reflect/value.go:345 (0x4640ad)
    Value.Call: return v.call("Call", in)
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/codegangsta/inject/inject.go:102 (0x4b0ff4)
    (*injector).Invoke: return reflect.ValueOf(f).Call(in), nil
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:165 (0x43a742)
    (*context).run: _, err := c.Invoke(c.handler())
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:156 (0x43a69b)
    (*context).Next: c.run()
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/recovery.go:140 (0x43eaf6)
    func.004: c.Next()
/opt/go/src/pkg/runtime/asm_amd64.s:339 (0x424252)
    call32: CALLFN(call32, 32)
/opt/go/src/pkg/reflect/value.go:474 (0x464fbb)
    Value.call: call(fn, ptr, uint32(size))
/opt/go/src/pkg/reflect/value.go:345 (0x4640ad)
    Value.Call: return v.call("Call", in)
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/codegangsta/inject/inject.go:102 (0x4b0ff4)
    (*injector).Invoke: return reflect.ValueOf(f).Call(in), nil
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:165 (0x43a742)
    (*context).run: _, err := c.Invoke(c.handler())
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:156 (0x43a69b)
    (*context).Next: c.run()
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/logger.go:25 (0x43e392)
    func.001: c.Next()
/opt/go/src/pkg/runtime/asm_amd64.s:340 (0x4242b2)
    call64: CALLFN(call64, 64)
/opt/go/src/pkg/reflect/value.go:474 (0x464fbb)
    Value.call: call(fn, ptr, uint32(size))
/opt/go/src/pkg/reflect/value.go:345 (0x4640ad)
    Value.Call: return v.call("Call", in)
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/codegangsta/inject/inject.go:102 (0x4b0ff4)
    (*injector).Invoke: return reflect.ValueOf(f).Call(in), nil
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:165 (0x43a742)
    (*context).run: _, err := c.Invoke(c.handler())
/uio/kant/usit-uait-u1/rodseth/go/src/github.com/go-martini/martini/martini.go:69 (0x439a63)
    (*Martini).ServeHTTP: m.createContext(res, req).run()
/opt/go/src/pkg/net/http/server.go:1597 (0x48a26e)
    serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/opt/go/src/pkg/net/http/server.go:1167 (0x488277)
    (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/opt/go/src/pkg/runtime/proc.c:1394 (0x417ab0)
    goexit: runtime·goexit(void)

I can not see any references to my own code, so I'm having a hard time pinpointing where this error lies. Any help is appreciated.

Best regards,
Alexander Rødseth
@gissues:{"order":50,"status":"done"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions