Closed DavidSatimeWallin closed 8 years ago
@dashaus I think the last changes you did broke it, please fix it, Iris framework uses your library and I hope that this will not change.
Edit 2: @dvwallin the iris' version is working now, @dashaus the problem was the nil slice, you're late to answer so I forced to make a fork of your code and edit it.
@dvwallin can you pass me the code that you are using? @kataras In the tests, the slices aren't initialize and are passed successfully.
Create a real example and you will see, this was the fix for our version of your package
I fixed a bug related with unmarshalText. I don't know if the bug is related with your problem @dvwallin. Try it again, please!
@kataras I use formam strongly in my project, and I use a lot slices. No problem I've found...
We had a problem with nil slices, I fixed because ,obviously, you will not xD anyway thanks for your package, is very good and simple, continue this!
if d.curr.IsNil() {
_newSlice := reflect.MakeSlice(d.curr.Type(), len(d.values), len(d.values))
reflect.Copy(_newSlice, d.curr)
d.curr.Set(_newSlice)
}
It is your fix? Because it is redundant. The expandSlice
function does this!
And the d.values
is only used when the field is slice/array without proving an index! Be careful...
And I have never had to do make([]string, 0), it is not necessary. Please, create a example without to use your framework and you can see that the error is no produced
And the d.values is only used when the field is slice/array without proving an index! Be careful..
Yes, because of this I'm using this , if it's 0 then no problem (golang no-setted int types are zero) , make an empty slice, and after expand it as you say, this is not something to worry about it.
It is your fix? Because it is redundant. The expandSlice function does this!
expandSlice doesn't expand the nil slices.
And I have never had to do make([]string, 0), it is not necessary. Please, create a example without to use your framework and you can see that the error is no produced
I did with pure fasthttp and html/template. Did you try to do an example with fasthttp or you use only net/http for your tests? Please do it and after answer me correctly. Thanks!
expandSlice doesn't expand the nil slices.
expandSlice expands nil slices. Your fix is not a fix. Is an unnecessary redundancy. It not should to do any effect positive neither negative in your framework. Your fix is a placebo: https://play.golang.org/p/p47CqZY7A9
I did with pure fasthttp and html/template. Did you try to do an example with fasthttp or you use only net/http for your tests? Please do it and after answer me correctly. Thanks!
If fasthttp
encode the form's values as do net/http
, then there should not be any problem. If fasthttp
encode the form's values in another way, formam
is not the package to use, formam
only allow url.Values
for decode in a struct or slice.
Well written answer, you've right.
Just updated (removed repo and did go get -u on this repo) and im getting a panic on reflection