Commits on Mar 7, 2019
Mar 6, 2019
This improves various parts of the godoc and README. Some docs could be improved a bit more, but this should fix most of the grammar oddities. I also improved the verbiage of errors, as some were a bit awkwardly worded as well. I also changed some of the formatting specifiers from `\"%v\"` to `%q`, as that looks a bit neater. Also use `fmt.Errorf()` inside `newError()`, as every invocation of `newError()` was using it. It also adds the checked error where applicable, which is more detailed than "not valid". I used my own judgement in changing some stuff around (e.g. putting the usage example higher in the README). Feel free to point out if you don't like some part and I can just change it back. I unexported some types that serve no purpose for users of formam as far as I can see to clean up the godoc a bit; I changed the tests to run from another package (formam_test) to make sure it still works well from another package (sometimes exporting is needed in decoding for visibility, e.g. in json). Fixes #1
I have a simple struct: type Test struct Name string `json:"name"` Website string `json:"website,omitempty"` } Since the names for `json` and the HTTP form are the same I thought I'd be clever and use `TagName: "json"` with formam. Unfortunately that doesn't work as the options (everything after the comma, ",omitempty") aren't ignored. This patch fixes that.