Skip to content

Migrate error comparisons to errors.Is/errors.As#84

Open
bobheadxi wants to merge 1 commit into
masterfrom
errors-is-as-migration-7f3a9c
Open

Migrate error comparisons to errors.Is/errors.As#84
bobheadxi wants to merge 1 commit into
masterfrom
errors-is-as-migration-7f3a9c

Conversation

@bobheadxi

Copy link
Copy Markdown
Member

This change migrates direct error comparisons and error type assertions to the
modern errors package idioms:

  • err == SentinelErr / err != SentinelErr -> errors.Is(err, SentinelErr) / !errors.Is(...)
    for sentinels such as sql.ErrNoRows, context.Canceled, context.DeadlineExceeded,
    http.ErrServerClosed, io.ErrUnexpectedEOF, os.ErrNotExist, etc.
  • Error type assertions and switch err.(type) classification -> errors.As.

Excluded by design: io.EOF comparisons (idiomatic in reader loops) and _test.go files.

This makes error checks robust to wrapped errors (fmt.Errorf("...: %w", err)).

Generated by a Sourcegraph batch change.

Created by Sourcegraph batch change robert/58006530-3ddc-4c11-ad42-8d8eed8bc63f.

@bobheadxi bobheadxi marked this pull request as ready for review June 15, 2026 18:23
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.

1 participant