Thank you Jan, I read the spec a bit more carefully after you pointed it out and I now understand that a constant and a non-constant value are treated differently and that my examples above is an example of just this.
"A constant value x can be converted to type T if x is representable by a value of T" In my example -65 is not representable in a byte (uint8) while for a non-constant, value x can be converted to type T if "x's type and T are both integer or floating point types" Cheers! /7i On Sunday, November 18, 2018 at 6:55:12 PM UTC+1, Jan Mercl wrote: > > > On Sun, Nov 18, 2018 at 6:42 PM <gith...@gmail.com <javascript:>> wrote: > > It's consistent with the language specification ;-) > > A constant value x can be converted to type T if x is representable by a > value of T. > > https://golang.org/ref/spec#Conversions > > > -- > > -j > -- 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.