-
Notifications
You must be signed in to change notification settings - Fork 44
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
Missing pointer value "0" while encoding struct #34
Comments
Thanks @mifanich for reporting, I suspect it's a bug in the omitempty logic thinking 0 is the default value after dereference, hopefully just an order of operations issue. |
@joeybloggs When do you plan to fix it |
As soon as I find the time, hopefully, this evening after work. if you need it sooner, PR's are welcome :) |
thank you very much |
@mifanich this should be fixed in v3.1.3 release, please let me know :) |
It works now. Thanks! |
type T struct {
X *uint8
form:"x,omitempty"
}
func main() {
tx := uint8(0)
x := T{&tx}
encoder := form.NewEncoder()
values, _ := encoder.Encode(x)
fmt.Println(values) // blank map
}
If I try to set value to 0, encoder ignores this field
The text was updated successfully, but these errors were encountered: