I’ve a new release of gen, the generics-like tool for Go. It includes API changes so I suggest reading the changelog. Highlights:

Markup instead of command-line

Where before you would specify types to gen at the command line, à la gen package.Type, now you simply add tags to types (in comments):

// +gen
type MyType struct {…}

…and the command-line simply becomes gen. This make re-generating easy, the specs are entirely in your code.

Projections

You can now project your types into other types, including primitives.

// +gen projections:”int,OtherType”
type MyType struct {…}

Type evaluation

This release includes much more evaluation of types to determine what they are capable of. So, for example, we know whether a type is comparable (usable as a map key), ordered (max, min, sort) or numeric (sum, average).

Tests

…are more complete and more granular.

Anything<T>

We’re now oriented for adding arbitrary generics-like functionality. Up next (probably), we’ll add support for containers, so you can simply generate (e.g.) Set<T>, List<T>, Pool<T>…

To update: go get -u github.com/clipperhouse/gen

Hope you like it, feedback welcome on Twitter or GitHub, both @clipperhouse.