Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-27 Thread Paul Jolly
Of course you don't need to us go/ast for output (it's very likely used heavily when working out what to generate based on Go source input) - I generally create some simple helper types that wrap a bytes.Buffer, generate most code using text/template into said buffer, format using golang.org/x/tool

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-23 Thread Tong Sun
Quite agree. code generation will be especially helpful if it is not something trivial, and you need several rounds to make it perfect. @hui zhang, If you need something generic, take a look at https://github.com/go-easygen/easygen, For e.g., here is how I generate the command line CLI ha

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-11 Thread Egon
On Saturday, 11 March 2017 02:27:49 UTC+2, Tyler Compton wrote: > > If we assume a more useful generic task than writing a min function, > what's wrong with using code generation? > There's nothing wrong with in it of itself. It's a tool like any other. Based on the limited information presented

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Michael Jones
Nothing wrong with it, and nothing wrong with doing it for min and max either. (Though it was a delight to see that animated editing sequence, so for entertainment value that's the way!) I did code generation for my version of Sort and it is 3x-5x faster. It takes intel more than 10 years to make

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Tyler Compton
If we assume a more useful generic task than writing a min function, what's wrong with using code generation? On Fri, Mar 10, 2017 at 6:14 AM Henry wrote: > If you insist on generics-like code generation: > https://github.com/cheekybits/genny/blob/master/README.md > > -- > You received this mess