On Sat, Nov 24, 2018 at 3:43 PM Ugorji Nwoke <ugo...@gmail.com> wrote:
Here is the authoritative <https://golang.org/ref/spec#Conversions> answer: """" A non-constant value x can be converted to type T in any of these cases: - x is assignable <https://golang.org/ref/spec#Assignability> to T. - ignoring struct tags (see below), x's type and T have identical <https://golang.org/ref/spec#Type_identity> underlying types <https://golang.org/ref/spec#Types>. - ignoring struct tags (see below), x's type and T are pointer types that are not defined types <https://golang.org/ref/spec#Type_definitions>, and their pointer base types have identical underlying types. - x's type and T are both integer or floating point types. - x's type and T are both complex types. - x is an integer or a slice of bytes or runes and T is a string type. - x is a string and T is a slice of bytes or runes. """" >From the above it follows that your case of converting between 'uint' and 'int' values at runtime is always valid due to: "x's type and T are both integer or floating point types." -- -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.