Proposal
|
panic("Expected number of values to match number of columns") |
This panic can be confusing, its simple enough to debug if you know what you're doing but if you pass a string with
len() = 25 it will of course panic if the developer does not spreading. Like with:
rows.AddRow(v) vs
rows.AddRow(v...) (Spreading will cause another issue with
[]string but I digress.
The former will compile but will panic. I wonder if you'd accept it to say "Expected number of values to match number of columns, expected %d, actual %d" to at least hint.
I wonder if this is acceptable or if it would break backwards compatibility in an unacceptable way. If you'd accept this change I'd gladly provide a PR.
Use-cases
Changing the panic message should simplify debugging sqlmock during development.
Otherwise we can close.
Proposal
go-sqlmock/rows.go
Line 169 in b2f0b45
This panic can be confusing, its simple enough to debug if you know what you're doing but if you pass a string with
len() = 25it will of course panic if the developer does not spreading. Like with:rows.AddRow(v)vsrows.AddRow(v...)(Spreading will cause another issue with[]stringbut I digress.The former will compile but will panic. I wonder if you'd accept it to say
"Expected number of values to match number of columns, expected %d, actual %d"to at least hint.I wonder if this is acceptable or if it would break backwards compatibility in an unacceptable way. If you'd accept this change I'd gladly provide a PR.
Use-cases
Changing the panic message should simplify debugging sqlmock during development.
Otherwise we can close.