top | item 22444772

(no title)

BarkMore | 6 years ago

A type alias binds a new name to a type. All of the type’s methods are available through the new name.

discuss

order

whateveracct|6 years ago

I fixed my comment. I didn't mean to have equal signs in there.

Proof that `type X Y` causes the issue: https://play.golang.org/p/erfcSIe-Z7b

BarkMore|6 years ago

The type definition `type X Y` declares new type X with the underlying type of Y. X and Y share underlying types and nothing else.

This is a useful feature and there's nothing weird or special case about how this works. It's just not the aliasing feature you expected.