I know you can use the empty interface but it hands off type checking to the runtime, which neglects the type system for a bit of generality and defeats the safety of having static typing in the first place.
You can also import the unsafe package and mess with pointers directly. Neither of these are problems.
Go strikes a nearly perfect balance between saving the programmer from accidentally shooting his foot off and getting the hell out of the way when the programmer is absolutely sure that the proper solution involves bending the rules a bit.
Thanks for this - I've been through the golang wiki tutorial, but this (ab)use of an empty interface for storing "any"-type in a collection was a great idiom to be aware of.
Another way to look at it is that an interface wraps a type by adding a pointer to an extra data structure, which identifies the type and functions on the type that implement the interface. Since interface{} has no functions, all that it carries is the type; it's concretely represented as a pair of the value and its type. Which is more or less how any language implements an "any" type.
(Disclaimer: it still feels awkward to me, but I found understanding the implementation of it helped me understand the why better. See also http://research.swtch.com/interfaces .)
http://www.amazon.com/Programming-Go-Creating-Applications-D...
This article is second in a series. Discussion of the previous article on HN: http://news.ycombinator.com/item?id=4351992