-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.17.6 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/guenter.prossliner@world-direct.at/.cache/go-build" GOENV="/home/guenter.prossliner@world-direct.at/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/guenter.prossliner@world-direct.at/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/guenter.prossliner@world-direct.at/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.6" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/guenter.prossliner@world-direct.at/proj/polly2/go.mod" 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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build117018826=/tmp/go-build -gno-record-gcc-switches"
What did you do?
This is part of a bigger application, but here is a repo:
https://go.dev/play/p/mD-R6gerA4c
What did you expect to see?
I expect that the net.OpErr which is returned by net.dialer.DialContext included the wrapped original error, which is a context.Canceled error.
This may be the problematic function. There is also a TODO from @bradfitz
Lines 419 to 434 in 40e24a9
// mapErr maps from the context errors to the historical internal net | |
// error values. | |
// | |
// TODO(bradfitz): get rid of this after adjusting tests and making | |
// context.DeadlineExceeded implement net.Error? | |
func mapErr(err error) error { | |
switch err { | |
case context.Canceled: | |
return errCanceled | |
case context.DeadlineExceeded: | |
return errTimeout | |
default: | |
return err | |
} | |
} |
What did you see instead?
UNEXPECTED:dial tcp: operation was canceled
EXPECTED: Get "http://github.com": context canceled
bcmills and ainar-ghopehook, gprossliner, moredure and twmb