I'm sure I'm not the only one, so could you explain the prank? Certainly the message you posted doesn't show up when I try to compile it...
Anyway, here is a solution: http://play.golang.org/p/Mg8x7sJ-hR
In other words, just insert the following line:
type int string
The thing is, "int" is not a reserved word in Go. It's just a predeclared binding. You can rebind it -- even use "int" as a local variable name, like so: http://play.golang.org/p/0_iTzkg-5mThere are other interesting cases. For example,
var true = false // Perfectly valid Go code!
I think of it as a prank because you could sneak such a line into somebody's code and the compiler would not help them realize what had happened, it would just complain about a lot of nonsense like 1 not being an int. In the "var true = false" example, there would not even be a compiler error, you'd just get baffling runtime errors.For a list of all the predeclared identifiers, see here: http://golang.org/ref/spec#Predeclared_identifiers