Original post

I quite often use code generators of enumerable types that support utility code for me (such as json marshalers), but I constantly miss some necessary functions. Therefore, I decided to make my fancy code generator with all the bells and whistles, and at the same time try out several ideas:

  • AST templating using astutil.Apply
    and embedded source files;
  • Empty struct singletones as namespaces;
  • source code as configuration for generator;

I already use this util in several private projects, so it quite adapted to my code style, but I’m open for suggestions and PR’s :3

enum2go repo

submitted by /u/twentydraft
[link] [comments]