Comments (4)
That's a subtle one! Indeed, the README is not up-to-date on this. We have to go through an assignment for this to work (your non-commented code):
form := new(LoginForm)
if errs := binding.Bind(req, form); errs.Handle(resp) {
return
}
see http://golang.org/ref/spec#Address_operators
from binding.
Nice find. And @wmark thanks for pointing out the discrepancy.
I could change the Handle
method to have a value receiver, which would enable that convenient, chained one-liner, rather than having to separate the assignment into a different statement. I tried this locally and confirmed that the example in the README still works, including that one line that is currently broken.
Making the change is simple. But I'm not sure if there are other implications of changing the receiver on that method from pointer to value. Can you think of any? If there aren't any obvious implications that I'm overlooking, I'll just make the change and resolve this issue.
from binding.
I don't see anything relevant here. Let's do it.
from binding.
Here's Rob Pike's comment on a related matter:
https://groups.google.com/d/msg/golang-nuts/INedfATw74A/XrIPT6gkB7kJ
from binding.
Related Issues (20)
- Expose *Binder interface for more byte oriented payloads HOT 2
- Feature request: Content-Type constraints HOT 1
- Re-thinking the binding package HOT 7
- Handling JSON arrays HOT 4
- template errors HOT 1
- 400 instead of 422 HOT 8
- Ability to control the HTTP error codes HOT 1
- autobindings to automatically create FieldMap functions for your structs HOT 1
- binding.Field.Required = true, ignored for struct fields. HOT 4
- JSON file as opposed to HTTPRequest? HOT 1
- Why not use govalidator internally? HOT 1
- Customise error message HOT 7
- Required error changed HOT 1
- Uploading file and json HOT 3
- Should FieldSpec.Binder have higher precedence than Binder.Bind?
- Errors object passed to Validate does not contain errors accumulated during Binding
- Automatic decoding of string HOT 1
- Best practice for operating on slices of data and keeping context HOT 4
- Binding Custom Types by Specifying Binder Func Does Not Work HOT 1
- [bug] error http: multipart handled by ParseMultipartForm if parse form before call binding.Bind HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binding.