Closed
Description
- What version of Go are you using (
go version
)?
go version go1.6 linux/amd64 - What operating system and processor architecture are you using (
go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1" - What did you do?
Try https://golang.org/pkg/net/http/#Get with an URL such as https://golang.org:
Playground link: http://play.golang.org/p/sKElWJHkz- (Won't execute on the playground due to restrictions.) - What did you expect to see?
No error. A response something to this effect:
2016/03/16 08:00:00 resp: &{GET https://golang.org HTTP/1.1 1 1 map[] <nil> 0 [] false golang.org map[] map[] <nil> map[] <nil> <nil>}
Quoting from http://tools.ietf.org/html/rfc3986#section-6.2.3, an
explicit ":port", for which the port is empty or the default for the
scheme, is equivalent to one where the port and its ":" delimiter are
elided and thus should be removed by scheme-based normalization. - What did you see instead?
2016/03/16 08:00:00 err: Get https://golang.org:: dial tcp 216.58.196.209:0: i/o timeout exit status 1
(Note that it's attempting to connect to port 0.)