Skip to content

refactor: use std errors#609

Open
janishorsts wants to merge 4 commits into
mainfrom
refactor-std-errors
Open

refactor: use std errors#609
janishorsts wants to merge 4 commits into
mainfrom
refactor-std-errors

Conversation

@janishorsts

Copy link
Copy Markdown
Collaborator

This PR migrates error handling from archived third-party dependencies (github.com/pkg/errors and github.com/hashicorp/go-multierror) to Go standard library patterns.

Changes

  • Standard Errors: Replaced pkg/errors with standard library "errors" and "fmt" (%w wrapping and errors.AsType).
  • Multi-Errors: Replaced go-multierror with standard errors.Join.
  • Cleanup: Removed the obsolete stack-trace printing in cmd/earthly/app/run.go.
  • Optimization: Optimized the WriterSub struct layout to reduce GC scan overhead (pointer bytes down to 40) and resolved style lints.
  • Dependencies: Removed both error libraries from go.mod and go.sum.

@janishorsts janishorsts self-assigned this Jun 25, 2026
@janishorsts janishorsts added the ai-assisted Authored with AI assistance label Jun 25, 2026
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

➖ Are we earthbuild yet?

No change in "earthly" occurrences

📈 Overall Progress

Branch Total Count
main 5340
This PR 5340
Difference +0

Keep up the great work migrating from Earthly to Earthbuild! 🚀

💡 Tips for finding more occurrences

Run locally to see detailed breakdown:

./.github/scripts/count-earthly.sh

Note that the goal is not to reach 0.
There is anticipated to be at least some occurences of earthly in the source code due to backwards compatibility with config files and language constructs.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the codebase to replace the third-party github.com/pkg/errors package with the Go standard library's errors and fmt packages, utilizing fmt.Errorf with %w for error wrapping and errors.Join for combining errors. The review feedback highlights a critical compilation error in ls_cmds.go due to the use of a non-existent errors.AsType function. Additionally, the feedback points out several instances of redundant or duplicate error wrapping, such as wrapping the same error twice in bootstrap_cmds.go, string concatenation inside fmt.Errorf in git.go, and duplicating the error message in shell_shared.go by both formatting and wrapping the error.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread cmd/earthly/subcmd/ls_cmds.go
Comment thread cmd/earthly/subcmd/bootstrap_cmds.go Outdated
Comment thread buildcontext/git.go
Comment thread util/containerutil/shell_shared.go Outdated
@janishorsts janishorsts added the enhancement New feature or request label Jun 25, 2026
@janishorsts janishorsts marked this pull request as ready for review June 25, 2026 18:18
@janishorsts janishorsts requested a review from a team as a code owner June 25, 2026 18:18
@janishorsts janishorsts requested review from gilescope and removed request for a team June 25, 2026 18:18
@janishorsts janishorsts removed the enhancement New feature or request label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Authored with AI assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant