Commit Graph

7 Commits

Author SHA1 Message Date
Benjamin Pflanz
d79b636dff Use idiomatic error messaging and variable naming, and don't make unnecessary changes. 2016-05-11 12:02:21 -04:00
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
pebers
0c6ac79cc6 Need to pass an explicit importer 2016-04-21 09:25:22 -04:00
pebers
bafb4908c3 Update imports to use builtin versions of packages from 1.5 since relevant bits of x/tools have gone away (see https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY). 2016-04-21 09:25:11 -04:00
pebers
e513687f72 Update imports to use builtin versions of packages from 1.5 since relevant bits of x/tools have gone away (see https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY). 2016-04-08 11:49:33 +01:00
Daved
c55a706513 Added prefix flag, and updated file name output. Changed parser
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.
2015-04-23 09:50:48 -07:00
Francesc Campoy
62c6805a74 moving the parser to a reusable package
Change-Id: Ic684b209c2179e357febdf48f068906058506500
2015-02-03 06:01:04 +00:00