GithubHelp home page GithubHelp logo

Comments (11)

unknwon avatar unknwon commented on June 18, 2024

Thanks your feedback!

But the error seems incomplete?

http: panic serving [::1]:61196: session(start): gob: name not registered for interface:

Does the : actually the last character or you didn't copy the error entirely?

from session.

aacanakin avatar aacanakin commented on June 18, 2024

After :, there exists the model path of user model

from session.

unknwon avatar unknwon commented on June 18, 2024

I need details please, that may help!

from session.

aacanakin avatar aacanakin commented on June 18, 2024

Ok. Here's the full dump

http: panic serving [::1]:63107: session(start): gob: name not registered for interface: "_/Users/aacanakin/Desktop/dev/gocode/src/project/models.User"
goroutine 10 [running]:
net/http.func·011()
    /usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1130 +0xbb
github.com/macaron-contrib/session.func·004(0xc20805d200)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/macaron-contrib/session/session.go:158 +0x14d
reflect.Value.call(0x41a860, 0xc2080ebe60, 0x13, 0x582220, 0x4, 0xc20800b620, 0x1, 0x1, 0x0, 0x0, ...)
    /usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:419 +0x10e5
reflect.Value.Call(0x41a860, 0xc2080ebe60, 0x13, 0xc20800b620, 0x1, 0x1, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:296 +0xbc
github.com/Unknwon/macaron/inject.(*injector).Invoke(0xc20800b540, 0x41a860, 0xc2080ebe60, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/Unknwon/macaron/inject/inject.go:102 +0x3c7
github.com/Unknwon/macaron.(*Context).run(0xc20805d200)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/Unknwon/macaron/context.go:113 +0x95
github.com/Unknwon/macaron.func·015(0x938c30, 0xc208045720, 0xc20801fd40, 0xc20803dd70)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/Unknwon/macaron/router.go:183 +0x3ec
github.com/Unknwon/macaron.(*Router).ServeHTTP(0xc208041f90, 0x938c30, 0xc208045720, 0xc20801fd40)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/Unknwon/macaron/router.go:271 +0x1ab
github.com/Unknwon/macaron.(*Macaron).ServeHTTP(0xc2080ec0e0, 0x938c30, 0xc208045720, 0xc20801fd40)
    /Users/aacanakin/Desktop/dev/gocode/src/github.com/Unknwon/macaron/macaron.go:171 +0x17c
net/http.serverHandler.ServeHTTP(0xc20805b2c0, 0x938c30, 0xc208045720, 0xc20801fd40)
    /usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc2080455e0)
    /usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
    /usr/local/Cellar/go/1.4.2/libexec/src/net/http/server.go:1751 +0x35e

This happens if I don't cleanup sessions folder and start the web server

from session.

unknwon avatar unknwon commented on June 18, 2024

Hi @aacanakin , thanks your info! I've pushed some changes, please use go get -u github.com/macaron-contrib/session and rebuild your program see if problem is being solved!

from session.

aacanakin avatar aacanakin commented on June 18, 2024

Hi @unknwon. The problem continues.

from session.

aacanakin avatar aacanakin commented on June 18, 2024

I looked at your commit. Before starting the app and registering the session middleware, If I add the following line; the problem is fixed;

gob.Register(models.User{})

But I think this is not an out of the box solution

from session.

unknwon avatar unknwon commented on June 18, 2024

@aacanakin thanks for the tip!

from session.

unknwon avatar unknwon commented on June 18, 2024

Did some researching, it seems no way to know what types are inside gob encoded data and register automatically.

In your case and other similar cases, I think user have to do:

func init() {
    gob.Register(&models.User{})
}

This way, gob knows how decode it.

from session.

aacanakin avatar aacanakin commented on June 18, 2024

Ok then, I'm closing this. Thanks.

from session.

unknwon avatar unknwon commented on June 18, 2024

@aacanakin sorry about it, maybe someday comes up a better way to encode data into binary, or should just store user ID in session and it's fast to read user info by ID from database.

from session.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.