And pls don't tell me interface{} is good , can solve your problem bla bla bla when interface{} meet slice []int --> []interface{} , all generic can not be done
在 2017年3月10日星期五 UTC+8下午4:29:20,hui zhang写道: > > > > 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.