Please use http://golang.org/pkg/net/#SplitHostPort as it handles IPv6 as well as parse errors.