This is not IPv6 compatible. Why not simply use `url.Parse` from `"net/url"`

http://play.golang.org/p/kClKARcxHc