Skip to content

Panic after merging pull request with jsoniter #991

@mtfelian

Description

@mtfelian

Copying my comment on commit ad08765

It broke compatibility with rendering some structs to JSON

We have a struct with non-exportable field tagged as json:"-"

All works on last commit c4249f9
but after merging this it broke.

2017/07/08 14:52:46 [Recovery] panic recovered:
GET /user?id=106848 HTTP/1.1
Host: 127.0.0.1:41184
Accept-Encoding: gzip
User-Agent: Go-http-client/1.1
User-Token: 106848V2Z1akVxa1NsMVdZUUFIRzNSSlNudGZiaGkyV01nc09sMlltQTlUeW9sWG


[optional]: [user.User]: [optional]: [gorm.DB]: [optional]: [gorm.search]: [optional]: [gorm.DB]: [optional]: [gorm.Callback]: [slice]: [optional]: unsupported type: func(*gorm.Scope)
/usr/local/go/src/runtime/panic.go:443 (0x42db99)
	gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/home/felian/go_code/src/github.com/gin-gonic/gin/render/json.go:33 (0x82fa57)
	JSON.Render: panic(err)
<autogenerated>:10 (0x83191a)
/home/felian/go_code/src/github.com/gin-gonic/gin/context.go:598 (0x66c46a)
	(*Context).Render: if err := r.Render(c.Writer); err != nil {
/home/felian/go_code/src/github.com/gin-gonic/gin/context.go:629 (0x66c7f2)
	(*Context).JSON: c.Render(code, render.JSON{Data: obj})
/home/felian/go_code/src/bitbucket.org/betscase/user-service/api.go:386 (0x4828fe)
	apiGetUser: c.JSON(http.StatusOK, user)
/home/felian/go_code/src/github.com/gin-gonic/gin/context.go:110 (0x66951a)
	(*Context).Next: c.handlers[c.index](c)
/home/felian/go_code/src/github.com/gin-gonic/gin/recovery.go:45 (0x67f491)
	RecoveryWithWriter.func1: c.Next()
/home/felian/go_code/src/github.com/gin-gonic/gin/context.go:110 (0x66951a)
	(*Context).Next: c.handlers[c.index](c)
/home/felian/go_code/src/github.com/gin-gonic/gin/logger.go:82 (0x67e702)
	LoggerWithWriter.func1: c.Next()
/home/felian/go_code/src/github.com/gin-gonic/gin/context.go:110 (0x66951a)
	(*Context).Next: c.handlers[c.index](c)
/home/felian/go_code/src/github.com/gin-gonic/gin/gin.go:337 (0x6735cd)
	(*Engine).handleHTTPRequest: context.Next()
/home/felian/go_code/src/github.com/gin-gonic/gin/gin.go:301 (0x673017)
	(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/go/src/net/http/server.go:2081 (0x621bee)
	serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1472 (0x61e43e)
	(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm_amd64.s:1998 (0x460b61)
	goexit: BYTE	$0x90	// NOP

Metadata

Metadata

Labels

type/bugFound something you weren't expecting? Report it here!

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions