-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codecs: Cannot call PublicData(map[string]int) because it does not implement codecs.Facade (i.e. needs PublicData method) and is not a Data object. #27
Comments
I'm getting the same issue running the example web-server provided (with ThingsController) |
This is a bug. We recently implemented the codecs package and it doesn't support arrays like this - I'll fix this today. Thanks
|
Thanks, Mat! We were using version 1.0 for the last 1.5 months for our application and now designed to migrate. Probably too early, but hopefully nothing serious happen. At least we can do some beta testing of the framework n real life. |
Yeah that's great - we will help you through the process. Check out our HipChat room too - we'll be hanging out there today. Sent from my iPhone
|
Side note: The repo name has changed from |
NOTE: The issue was in the codecs package… see stretchr/codecs#9
@oleksandr I think this is now fixed... can you confirm/deny? |
... you will need to update both |
Fixed! |
A simple REST controller with a method:
func (ctrl _MyController) ReadMany(ctx context.Context) error {
var Things []_Thing
thing := new(Thing)
thing.Id = "A"
thing.Text = "A Thing!"
Things = append(Things, thing)
return goweb.API.RespondWithData(ctx, Things)
}
Request: GET /api/my
Leads to the following in the console:
2013/06/12 10:53:32 http: panic serving 127.0.0.1:49779: codecs: Cannot call PublicData([]_controllers.Thing) because it does not implement codecs.Facade (i.e. needs PublicData method) and is not a Data object.
goroutine 11 [running]:
net/http.func·007()
/usr/local/go/src/pkg/net/http/server.go:1022 +0xac
github.com/stretchrcom/codecs.publicData(0x274fe0, 0xc200151c60, 0x0, 0x0, 0x6e7a30, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/codecs/facade.go:106 +0x2fe
github.com/stretchrcom/codecs.PublicData(0x274fe0, 0xc200151c60, 0x0, 0x1, 0x2842a0, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/codecs/facade.go:63 +0x42
github.com/stretchrcom/goweb/responders.(_GowebAPIResponder).Respond(0xc2000eb7e0, 0xc2000dc7e0, 0xc200157c40, 0xc8, 0x274fe0, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/responders/goweb_api_responder.go:130 +0xa8
github.com/stretchrcom/goweb/responders.(_GowebAPIResponder).RespondWithData(0xc2000eb7e0, 0xc2000dc7e0, 0xc200157c40, 0x274fe0, 0xc200151c60, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/responders/goweb_api_responder.go:155 +0x6c
project/api/controllers.(_MyController).ReadMany(0xc2000008a8, 0xc2000dc7e0, 0xc200157c40, 0x1, 0x1, ...)
/Users/alex/Documents/Work/sources/backend/src/project/api/controllers/poi.go:37 +0x171
github.com/stretchrcom/goweb/controllers.RestfulManyReader.ReadMany·fm(0xc2000dc7e0, 0xc200157c40, 0x0, 0x0)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/mapping.go:234 +0x52
github.com/stretchrcom/goweb/handlers.(_PathMatchHandler).Handle(0xc2000ebf00, 0xc2000dc7e0, 0xc200157c40, 0x1, 0x0, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/path_match_handler.go:137 +0x38
github.com/stretchrcom/goweb/handlers.Pipe.Handle(0xc200100600, 0x17, 0x20, 0xc2000dc7e0, 0xc200157c40, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/pipe.go:61 +0x121
github.com/stretchrcom/goweb/handlers.(_Pipe).Handle(0xc200151800, 0xc2000dc7e0, 0xc200157c40, 0xdd301, 0x0, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/default_error_handler.go:0 +0x9a
github.com/stretchrcom/goweb/handlers.Pipe.Handle(0xc20014d690, 0x3, 0x3, 0xc2000dc7e0, 0xc200157c40, ...)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/pipe.go:61 +0x121
github.com/stretchrcom/goweb/handlers.(_HttpHandler).ServeHTTP(0xc2001468c0, 0xc2001544c0, 0xc200157bd0, 0xc20014b680)
/Users/alex/Documents/Work/sources/backend/src/github.com/stretchrcom/goweb/handlers/http_handler.go:67 +0xac
net/http.serverHandler.ServeHTTP(0xc200147820, 0xc2001544c0, 0xc200157bd0, 0xc20014b680)
/usr/local/go/src/pkg/net/http/server.go:1517 +0x16c
net/http.(_conn).serve(0xc2000e26c0)
/usr/local/go/src/pkg/net/http/server.go:1096 +0x765
created by net/http.(*Server).Serve
/usr/local/go/src/pkg/net/http/server.go:1564 +0x266
The text was updated successfully, but these errors were encountered: