Well, it's easy enough if you check that it's a non-negative integer to start with :)
If it's negative, you'd have to decide what to do - return an error, panic or circumvent the problem in some other way. Alan On Friday, September 14, 2018 at 1:40:41 PM UTC+1, ohir wrote: > > On Fri, 14 Sep 2018 03:32:09 -0700 (PDT) > alanfo <alan...@gmail.com <javascript:>> wrote: > > > https://gist.github.com/alanfo/fb2438f376dac0db3be5664702f39aab > > > > Any comments or constructive criticism are of course welcome. > > > https://gist.github.com/alanfo/fb2438f376dac0db3be5664702f39aab > > " it is easy enough to convert between signed and unsigned integers so I > > don't think this is an important enough use case to justify its > inclusion." > > Easy? > > https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules > > https://play.golang.org/p/wZh8gv47wjz Play with sized ;) > > CGG: https://github.com/ohir/gonerics > > -- > Wojciech S. Czarnecki > << ^oo^ >> OHIR-RIPE > -- 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.