jsonenums/parser
Benjamin Pflanz 7fbe89f60d Use static parsing instead of requiring a binary.
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.
2016-04-21 21:31:47 -04:00
..
parser.go Use static parsing instead of requiring a binary. 2016-04-21 21:31:47 -04:00