Commit Graph

43 Commits

Author SHA1 Message Date
BenTrapani
8ec93328be Update template to include DB functions and correct json format as per
snake case names
2016-07-29 15:29:41 -04:00
BenTrapani
67c61e436f Create map to hold both cases and populate 2016-07-29 15:29:21 -04:00
BenTrapani
2c325e3c76 Add logic to convert camel case to snake case 2016-07-29 15:28:51 -04:00
Francesc Campoy
ff3de3c0dd Merge pull request #12 from adfin/master
Use static parsing instead of requiring a binary.
2016-05-27 18:16:08 -05:00
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
b89a8c9df8 Correct imports and variable naming. 2016-05-03 18:50:41 -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
fb3be6d28a Need to update these paths too. 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
Francesc Campoy
5bfdb73f88 Merge pull request #11 from thought-machine/use-golang15-builtins
Update imports to use builtin versions of packages from 1.5.
2016-04-19 12:14:23 -07: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
Francesc Campoy
36bac1a5f6 Merge pull request #8 from neurodrone/master
Correct jsonenums go-generate example run
2015-07-15 10:29:57 -07:00
Francesc Campoy
c46b65ebad Merge pull request #7 from daved/quick0
Cleaned up previous pull request; Prefix, comment additions, typos
2015-06-08 08:56:24 -07:00
Vaibhav Bhembre
95e85aea50 Correct jsonenums go-generate example run 2015-06-07 22:16:57 -04:00
Daved
f6a8246543 Corrected MarshalJSON and UnmarshalJSON function comments within
template per Francesc's guidance.
2015-04-23 13:35:24 -07: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
Daved
3699e12530 Added MarshalJSON and UnmarshalJSON comments to template to prevent
golint from complaining.
2015-04-23 09:30:11 -07:00
Daved
a9a20fa77c Corrected minor typo in last paragraph of package main comment. 2015-04-23 09:24:46 -07:00
Daved
003b2577f0 Corrected minor typo in second to last paragraph of readme. 2015-04-23 09:24:46 -07:00
Francesc Campoy
c80e0662c2 Merge pull request #5 from campoy/refactor
Add server
2015-02-04 13:45:11 +00:00
Francesc Campoy
081abb7721 added license comments 2015-02-04 13:44:42 +00:00
Francesc Campoy
07f271932b Merge branch 'refactor' of https://github.com/campoy/jsonenums into refactor 2015-02-04 13:42:12 +00:00
Francesc Campoy
a77ef8d8e5 Updated generated code in example 2015-02-04 13:40:08 +00:00
Francesc Campoy
dfe6af903e Improved generated code by defining map outside of function. 2015-02-04 13:38:28 +00:00
Francesc Campoy
40291a96dd Adding server for code generation 2015-02-04 13:30:07 +00:00
Francesc Campoy
0ab873adbf Merge pull request #4 from campoy/refactor
moving the parser to a reusable package
2015-02-04 13:20:24 +00:00
Francesc Campoy
3763fb8613 removed useless diff 2015-02-03 06:04:04 +00:00
Francesc Campoy
62c6805a74 moving the parser to a reusable package
Change-Id: Ic684b209c2179e357febdf48f068906058506500
2015-02-03 06:01:04 +00:00
Francesc Campoy
175ecc603a Merge pull request #2 from shurcooL/patch-1
README: Fix formatting by adding missing closing backtick.
2015-02-02 16:05:44 +00:00
Francesc Campoy
720371a4aa Merge pull request #3 from shurcooL/patch-3
README: Improve formatting by removing unneeded indent.
2015-02-02 16:04:55 +00:00
Dmitri Shuralyov
869bf3d2d3 README: Improve formatting by removing unneeded indent.
Since a fenced code block (three backticks) is already used, there's no need to indent code blocks. Either a fenced code block or an indent alone is enough.
Also use tabs instead of spaces in Go code to make it gofmt-compatible, and use Go syntax highlighting for Go code blocks.
Unlike 1e1ffecf4f148c30fb214feeb491c7de5fe54e56, only use Go syntax highlighting for complete Go code block, since GitHub renders it poorly for partial Go code.
2015-02-01 09:43:22 -08:00
Dmitri Shuralyov
718a04d0a6 README: Fix formatting by adding missing closing backtick. 2015-02-01 09:34:53 -08:00
Francesc Campoy
ae9812cb50 Added Google disclaimer 2015-02-01 16:05:25 +01:00
Francesc Campoy
0ef05ba2c2 Merge pull request #1 from campoy/initial
initial commit
2015-02-01 16:04:22 +01:00
Francesc Campoy
63815420d0 Update README.md 2015-02-01 09:37:31 +01:00
Francesc Campoy
90659514af corrected case of jsonenums 2015-01-31 12:23:24 +01:00
Francesc Campoy
5cd7ec204a support of decoding for Stringers 2015-01-31 12:21:55 +01:00
Francesc Campoy
a673e22384 improved the generated code by using maps and using existing String method if available 2015-01-31 11:09:02 +01:00
Francesc Campoy
3da4e90d43 Move the go:generate comments one line up to avoid documenting the type 2015-01-31 10:21:59 +01:00
Francesc Campoy
10933b856e added demo file 2015-01-29 17:00:50 +01:00
Francesc Campoy
66a9dd356f initial commit 2015-01-29 11:35:15 +01:00
Francesc Campoy
fb5644d041 Initial commit 2015-01-29 00:18:46 +01:00