Skip to content

Replace xerrors with fmt.Errorf - #107

Merged
keroxp merged 3 commits into
mainfrom
no-xerrors
Feb 5, 2026
Merged

Replace xerrors with fmt.Errorf#107
keroxp merged 3 commits into
mainfrom
no-xerrors

Conversation

@keroxp

@keroxp keroxp commented Feb 5, 2026

Copy link
Copy Markdown
Member

Replace usages of golang.org/x/xerrors with the standard library fmt.Errorf across the project. Updated imports to add fmt where needed, adjusted tests to use fmt.Errorf, and removed the xerrors dependency from go.mod/go.sum. This simplifies error handling by relying on the standard library's %w error wrapping and removes an external dependency.

Replace usages of golang.org/x/xerrors with the standard library fmt.Errorf across the project. Updated imports to add fmt where needed, adjusted tests to use fmt.Errorf, and removed the xerrors dependency from go.mod/go.sum. This simplifies error handling by relying on the standard library's %w error wrapping and removes an external dependency.
@codecov

codecov Bot commented Feb 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.14%. Comparing base (c4378bf) to head (dbde825).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
env/env.go 66.66% 3 Missing ⚠️
up.go 25.00% 3 Missing ⚠️
cli/cage/upgrade/upgrade.go 66.66% 2 Missing ⚠️
cli/cage/prompt/prompt.go 50.00% 1 Missing ⚠️
run.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files          38       38           
  Lines        1695     1695           
=======================================
  Hits         1528     1528           
  Misses        116      116           
  Partials       51       51           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request removes the external dependency on golang.org/x/xerrors and replaces it with the standard library's fmt.Errorf function, which has supported error wrapping with %w since Go 1.13. This simplifies the codebase by eliminating an external dependency while maintaining identical error handling semantics.

Changes:

  • Replaced all xerrors.Errorf and xerrors.New calls with fmt.Errorf across 11 Go files
  • Added fmt import to files where it was needed
  • Removed golang.org/x/xerrors dependency from go.mod and go.sum

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
up.go Replaced xerrors with fmt.Errorf for service creation and waiting errors
task_definition_test.go Updated test mocks to use fmt.Errorf instead of xerrors.New
task/simple_task.go Replaced xerrors error formatting for canary task failures
task/common.go Replaced all xerrors calls with fmt.Errorf for task management errors
task/alb_task.go Replaced xerrors with fmt.Errorf and refactored if-else to switch statement
run.go Updated all error messages to use fmt.Errorf for task execution errors
rollout.go Replaced xerrors with fmt.Errorf for rollout validation and execution errors
env/env.go Updated environment validation and file loading errors to use fmt.Errorf
cli/cage/upgrade/upgrade.go Replaced xerrors with fmt.Errorf for upgrade-related errors
cli/cage/prompt/prompt.go Updated prompt confirmation errors to use fmt.Errorf
cli/cage/commands/command.go Replaced xerrors with fmt.Errorf for argument validation
go.mod Removed xerrors dependency
go.sum Removed xerrors dependency checksums

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread task/alb_task.go Outdated
@keroxp
keroxp merged commit 5a1c4aa into main Feb 5, 2026
1 check passed
@keroxp
keroxp deleted the no-xerrors branch February 5, 2026 06:10
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