I'm defining a type. I notice that Go has a type called uint8
and a function called uint8
which creates a uint8
value.
But when I try to do this for myself:
12: type myType uint32
14: func myType(buffer []byte) (result myType) { ... }
I get the error
./thing.go:14: myType redeclared in this block
previous declaration at ./thing.go:12
If I change it to func newMyType
that works but it feels like I'm a second class citizen. Can I write type constructor functions with the same ident as type type?