Skip to content
Permalink
Branch: master
Commits on Mar 7, 2019
  1. Add benchmarks

    Carpetsmoker committed Mar 7, 2019
    I copied the benchmarks from
    https://github.com/monoculum/formam-benchmark
    
    This just makes it easier to run comparative benchmarks, i.e. when
    changing the code.
  2. Improve documentation

    Carpetsmoker committed 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
  3. Ignore struct tag options

    Carpetsmoker committed Mar 7, 2019
    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.
  4. Add go.mod file

    Carpetsmoker committed Mar 7, 2019
    This is useful even when the project doesn't have any dependencies, as
    it will allow the "go" tool, various helper tools, and IDEs recognize
    which import path this is when using it outside of GOPATH
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.