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
mime/multipart: wrong error wrapping in multipart.go on L346? #54133
Comments
Do you have a code example that doesn't work as expected? Thanks. |
hi @cherrymui, here is a code example: https://go.dev/play/p/BfjeTIOkq-M |
From the definition of
This is an unexpected end of input, so the error is correct. |
hi @seankhliao, |
but allowing you to test against EOF is wrong, since EOF represents a clean exit, and this is not |
hi @seankhliao,
by using "%v" the caller can not check the error and it does not have to be an io.EOF error - it could be any error... further I do not understand what you mean by "but allowing you to test against EOF is wrong, since EOF represents a clean exit, and this is not" - you should be allowed to test against any error (error wrapping - https://pkg.go.dev/errors) but thats a different topic... |
What version of Go are you using (
go version
)?go1.18.3 linux/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
tried to catch errors with
errors.Is(err, io.EOF)
frommultipart.NewReader(...)..NextPart()
What did you expect to see?
expected to catch io.EOF errors, but it seems to only work if we enter the
if
in L337 - io.EOF is directly returned.What did you see instead?
multipart: NextPart: EOF
--> wrongly (?) wrapped errorchanging
%v
to%w
in L346 fixed this issue - so most likely a bug?The text was updated successfully, but these errors were encountered: