Adds a new flag, `-bson`, which will also generate `MarshalBSON` and
`UnmarshalBSON` commands that satisfy interfaces specified in
gopkg.in/mgo.v2/bson.
Using go/parser requires a built binary of the code to be enum'ed to
exist. This leads to two problems:
1. The binary may be very out of date with the code, for example, when
pulling into an existing repo that was last built locally some time
ago, running jsonenums on newly added files will fail;
2. If the binary has never been built, but the code already expects
the output of jsonenums, it will be impossible to generate the enums,
making it impossible to build the binary.
In response to a similar issue, Alan Donovan of the Go team suggested
that instead generating tools should be using (the not-yet stable)
x/tools/go/loader package to parse the actual Go code itself rather than
the compilation output: https://github.com/golang/go/issues/11415
This change uses the suggested approach to break the bootstrapping
dependency cycle.
package's ParsePackage to take prefix and updated related skip
conditional. Also updated args in call to ParsePackage within
server. Last paragraph of main package comment was updated, along
with the second to last paragraph of readme.