Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/poll: Changed error string breaks user application #19252

Closed
typeless opened this issue Feb 23, 2017 · 4 comments
Closed

internal/poll: Changed error string breaks user application #19252

typeless opened this issue Feb 23, 2017 · 4 comments

Comments

@typeless
Copy link

@typeless typeless commented Feb 23, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version devel +3792db5 Mon Feb 13 18:36:28 2017 +0000 linux/amd64
It works on Go 1.8

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mura/devel/go"
GORACE=""
GOROOT="/home/mura/tools/go"
GOTOOLDIR="/home/mura/tools/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build174238897=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

make integration-test for the code I am working on.
go-gitea/gitea#741 (comment)
But I think that doesn't matter after all.

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

All tests passed.

What did you see instead?

All tests failed.

It turned out that one of the dependent libraries ( (See https://github.com/facebookgo/httpdown/blob/master/httpdown.go#L338) uses the exact error string to make its decision and the string in question was changed at some point of time (3792db5#diff-18782360650b1a2ccfee593591ff45bbR17). This may not be the fault of the error string changing but I'd like to know what the recommended solution (an idimatic way for differentiating errors) is for the case. And maybe the possible impact can be prepared before the next production release.

@mvdan

This comment has been minimized.

Copy link
Member

@mvdan mvdan commented Feb 23, 2017

As far as I know, error strings are not under the Go1 compatibility contract. If your program depends on them, it might break in the future or not be portable at all (e.g. some os errors change between operating systems, I believe).

The way to do this in a portable and backwards/forwards compatible way is to check for error types, not error messages. Although that won't be possible if the package just uses errors.New().

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 24, 2017

This is related to #4373.

@bradfitz bradfitz added this to the Go1.9 milestone Mar 21, 2017
@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Mar 21, 2017

Marking for Go 1.9.

This may not be the fault of the error string changing but I'd like to know what the recommended solution (an idimatic way for differentiating errors) is for the case

Indeed.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 7, 2017

CL https://golang.org/cl/39997 mentions this issue.

@gopherbot gopherbot closed this in fb4b434 Apr 26, 2017
@golang golang locked and limited conversation to collaborators Apr 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.