go-gorp/gorp

Panic when trace logging is on

lbyte00 opened this issue · 1 comments

We've got a problem that gorp causes panic when trying to get the value of nil pointer.
And the solution is simple, adding a check for nil pointer to argsString function and if it's true then setting interface value to nil.

Probably someone has a better solution.
Here's the PR: #374

panic: value method github.com/wallester/card-service/vendor/github.com/go-openapi/strfmt.UUID4.Value called using nil *UUID4 pointer

goroutine 143 [running]:
github.com/wallester/card-service/vendor/github.com/go-openapi/strfmt.(*UUID4).Value(0x0, 0x178e020, 0x0, 0x22a4758, 0x0)
	<autogenerated>:1 +0x86
github.com/wallester/card-service/vendor/github.com/go-gorp/gorp.argsString(0xc4200fe200, 0x1c, 0x20, 0xc4201c9148, 0x102ac34)
	/Users/lbyte00/Developer/go/src/github.com/wallester/card-service/vendor/github.com/go-gorp/gorp/gorp.go:139 +0x37f
github.com/wallester/card-service/vendor/github.com/go-gorp/gorp.(*DbMap).trace(0xc42049b180, 0xbec0648bc740baf4, 0x1572e9796, 0x1ccdf60, 0xc420378780, 0x267, 0xc4200fe200, 0x1c, 0x20)
	/Users/lbyte00/Developer/go/src/github.com/wallester/card-service/vendor/github.com/go-gorp/gorp/db.go:784 +0x64
github.com/wallester/card-service/vendor/github.com/go-gorp/gorp.(*Transaction).Exec(0xc42052c9f0, 0xc420378780, 0x267, 0xc4200fe200, 0x1c, 0x20, 0x18f2d20, 0xc420383de0, 0x0, 0x0)
	/Users/lbyte00/Developer/go/src/github.com/wallester/card-service/vendor/github.com/go-gorp/gorp/transaction.go:74 +0xcf
github.com/wallester/card-service/vendor/github.com/go-gorp/gorp.insert(0xc42049b180, 0x18fe2c0, 0xc42052c9f0, 0xc42067a900, 0x1, 0x1, 0xed2b31101, 0xc42067a900)
	/Users/lbyte00/Developer/go/src/github.com/wallester/card-service/vendor/github.com/go-gorp/gorp/gorp.go:598 +0xa96
github.com/wallester/card-service/vendor/github.com/go-gorp/gorp.(*Transaction).Insert(0xc42052c9f0, 0xc42067a900, 0x1, 0x1, 0xed2b311af, 0x0)
	/Users/lbyte00/Developer/go/src/github.com/wallester/card-service/vendor/github.com/go-gorp/gorp/transaction.go:40 +0x5e
github.com/wallester/card-service/repository.(*Card).InsertCardInTransaction(0xc420270650, 0x18fb880, 0xc42052c9f0, 0xc420393a70, 0x24, 0xc4202953e0, 0x24, 0x0, 0x0, 0x0, ...)

Fixed: #374