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

Fix isNetClosedErr #264

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Fix isNetClosedErr #264

merged 1 commit into from
Dec 1, 2022

Conversation

PleasingFungus
Copy link
Contributor

I believe that d5e80b3 reversed its build constraints. It looks like the intent is to use error.Is from Go 1.16 onward, and to use strings.Contains in Go 1.15.

However, per https://pkg.go.dev/cmd/go#hdr-Build_constraints , the go1.15 tag is set for all Go versions from Go 1.15 onward. That means that go115.go will be used in Go 1.16 and onward, and go116.go will only be used in Go 1.15.

This commit reverses that, so that go115.go (string.Contains) is used in Go 1.15 and go116.go (error.Is) is used in Go 1.16 onward.

I believe that d5e80b3 reversed its
build constraints. It looks like the intent is to use `error.Is` from
Go 1.16 onward, and to use `strings.Contains` in Go 1.15.

However, per https://pkg.go.dev/cmd/go#hdr-Build_constraints , the
go1.15 tag is set for all Go versions from Go 1.15 *onward*. That means
that go115.go will be used in Go 1.16 and onward, and go116.go will
only be used in Go 1.15.

This commit reverses that, so that go115.go (string.Contains) is used
in Go 1.15 and go116.go (error.Is) is used in Go 1.16 onward.
Copy link
Owner

@twmb twmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, checked the assembly of compiling this on 1.16.15 without this patch and with this patch. Without this patch, isNetClosedErr is not inlined and uses the definition in go115.go. With this patch, the function is inlined and uses errors.Is.

@twmb twmb merged commit c470843 into twmb:master Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants