It does work (i.e., compiles) if you use a type alias (note the equal sign):
type uintXXX = uint Whether it is a good idea to allow it to work using two distinct types that have the same underlying type is debatable. Personally, I think the current behavior (not allowing the conversion) is preferable. On Sun, Jul 16, 2023 at 9:02 AM Leonard Mittmann <leonard.mittm...@gmail.com> wrote: > Hi everyone, I am wondering if there is efficient way to do the following > type conversion (without looping over the map): > > var m = map[uint]uint{ /*...*/ } > type uintXXX uint > // this does not work > var m2 map[uintXXX]uintXXX = (map[uintXXX]uintXXX)(m) > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/3051ef4c-718b-4bbd-bac4-b0bf9a414283n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/3051ef4c-718b-4bbd-bac4-b0bf9a414283n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD8-7wM%3D4naS%3DLbLFg2N-%2BJgDi4mMku5B5qAzkY8Px-xbA%40mail.gmail.com.