Actually, it would be quite nice to simplify the Go's AST package and makes it simpler for people to develop custom code generation and tools. I use code generation quite a lot, eg. to generate data-access code, etc., but the process of creating one requires some effort to get right. I think go generate shows a lot of promise and it is currently underused. It is probably one area where Go can potentially outshine other programming languages.
On Friday, March 10, 2017 at 3:29:20 PM UTC+7, hui zhang wrote: > > > > I want to generate a min func > > func Min(a,b T) T { > if a < b { > return a > } else { > return b > } > } > > > pls generate below, pls use go generate to generate int int64 int32 > int16.... uint64 uint32 .... float32 float64 > Pls do not just paste documents. There is a lot on google. but none of > them explain it clearly > Just tell me how to do the below things generate by demo. > > > func MinInt32(a,b int32) int32 { > if a < b { > return a > } else { > return b > } > } > > func Minint(a,b int) int { > if a < b { > return a > } else { > return b > } > } > > func Minfloat32(a,b float32) float32 { > if a < b { > return a > } else { > return b > } > } > > > ............ > > > > > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.