Skip to content

crypto/tls: On a failed call to tls.Dial the returned net.Conn evaluates to false on comparison of net.Conn == nil, but prints <nil> when printing the value #24835

Description

@raz-varren

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

I've reproduced the error on go 1.10.1 linux and 1.9.2 darwin

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

I've produced the error on my mac:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/russell/gocode"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d3/kzyj6l8s5j3fz4848dls2tjw0000gn/T/go-build303409938=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

and on my linux docker container:
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gt/gocode"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build289060333=/tmp/go-build -gno-record-gcc-switches"

What did you do?

During a failed call to tls.Dial, the returned net.Conn fails to evaluate to true in a comparison of net.Conn == nil.
The error is reproducible here: https://play.golang.org/p/KlpsoDFmEnf

What did you expect to see?

If an error occurs during a call to tls.Dial, the returned net.Conn should evaluate to true in a comparison of net.Conn == nil

What did you see instead?

net.Conn == nil evaluates to false, even though fmt.Println(net.Conn) will print <nil>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions