Skip to content

[v11] fix: use errors.Is for all EOF comparisons#26021

Merged
nklaassen merged 1 commit intobranch/v11from
nklaassen/v11/errors-is-EOF
May 10, 2023
Merged

[v11] fix: use errors.Is for all EOF comparisons#26021
nklaassen merged 1 commit intobranch/v11from
nklaassen/v11/errors-is-EOF

Conversation

@nklaassen
Copy link
Copy Markdown
Contributor

Backport #26012 to branch/v11

This commit updates all err == io.EOF comparisons to use errors.Is(err, io.EOF). This is necessary when the error may have been wrapped and fixes at least one current breakage (in tsh request ls).

golang.org/x/tools/refactor/eg was very handy for this, I used the following template:

package teleport
import (
	"errors"
	"io"
)
func before(err error) bool { return err == io.EOF }
func after(err error) bool  { return errors.Is(err, io.EOF) }

Backport #26012 to branch/v11

This commit updates all `err == io.EOF` comparisons to use
`errors.Is(err, io.EOF)`. This is necessary when the error may have been
wrapped and fixes at least one current breakage (in `tsh request ls`).

`golang.org/x/tools/refactor/eg` was very handy for this, I used the
following template:

```go
package teleport
import (
	"errors"
	"io"
)
func before(err error) bool { return err == io.EOF }
func after(err error) bool  { return errors.Is(err, io.EOF) }
```
@nklaassen nklaassen requested review from rosstimothy and zmb3 May 10, 2023 19:25
@github-actions github-actions Bot requested a review from rosstimothy May 10, 2023 19:33
@github-actions github-actions Bot added audit-log Issues related to Teleports Audit Log backport kubernetes-access size/sm tctl tctl - Teleport admin tool labels May 10, 2023
@nklaassen nklaassen enabled auto-merge May 10, 2023 19:50
@nklaassen nklaassen added this pull request to the merge queue May 10, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 10, 2023
@nklaassen nklaassen added this pull request to the merge queue May 10, 2023
Merged via the queue into branch/v11 with commit 6871446 May 10, 2023
@nklaassen nklaassen deleted the nklaassen/v11/errors-is-EOF branch May 10, 2023 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit-log Issues related to Teleports Audit Log backport kubernetes-access size/sm tctl tctl - Teleport admin tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants