Skip to content

[Refactor] migrate pkg/errors to Crossplane Errors#428

Open
siddimore wants to merge 1 commit intocrossplane-contrib:mainfrom
siddimore:refactor/use-xp-errors
Open

[Refactor] migrate pkg/errors to Crossplane Errors#428
siddimore wants to merge 1 commit intocrossplane-contrib:mainfrom
siddimore:refactor/use-xp-errors

Conversation

@siddimore
Copy link
Copy Markdown

@siddimore siddimore commented Mar 4, 2026

Description of your changes

Migrate from deprecated github.com/pkg/errors to github.com/crossplane/crossplane-runtime/v2/pkg/errors.

Why:

github.com/pkg/errors is no longer actively developed and is in maintenance mode since 2021

  • The codebase was inconsistently using both pkg/errors and crossplane-runtime/v2/pkg/errors.
  • crossplane-runtime/v2/pkg/errors provides native Go 1.13+ error wrapping compatibility (errors.Is/errors.As) plus crossplane-specific utilities like WithSilentRequeueOnConflict
  • Reduces direct dependency footprint (pkg/errors is now only an indirect dependency)

Changes:

  • Replace all direct imports of github.com/pkg/errors with github.com/crossplane/crossplane-runtime/v2/pkg/errors
  • Use xperrors alias in reconciler.go files to disambiguate from kerrors (k8s api errors)
  • Run go mod tidy to clean up dependencies

FilesChanged:

  • client: upbound, aws, gke, azure, client.go, ssa/cache/extractor
  • cluster: object, observedobjectcollection
  • namespaced: object, observedobjectcollection

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

  • All 219+ unit tests pass (go test)
  • Build succeeds (go build)
  • go vet passes with no issues
  • Import changes are mechanical (find/replace) with no logic changes

@siddimore siddimore marked this pull request as ready for review March 4, 2026 18:11
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