Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new gerrors package for structured error wrapping (with details, messages, and exit codes) and replaces prior ad-hoc error-handling logic across internal pipes and CLI commands.
- Add
internal/gerrorswithWrap,WrapExit, and detail/exit/message accessors - Remove old
errDetailedfrominternal/pipeand switch usage togerrors - Update CLI (
cmd/) to usegerrorsfor exit codes, messages, and details, removing legacy helpers
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pipe/pipe_test.go | Removed legacy tests for NewDetailedError |
| internal/pipe/pipe.go | Dropped old DetailsOf and NewDetailedError implementations |
| internal/pipe/build/build.go | Swapped pipe.NewDetailedError for gerrors.Wrap |
| internal/gerrors/errors.go | Added new gerrors implementation |
| internal/gerrors/errors_test.go | Added tests for gerrors.Wrap and accessors |
| cmd/root.go | Replaced custom exit handler with gerrors.ExitOf/MessageOf |
| cmd/error.go | Removed legacy exitError type |
| cmd/release.go | Updated releaseProject to use decorateWithCtxErr and after |
| cmd/check.go | Rewrote error aggregation to use gerrors |
| cmd/build.go | Updated buildProject to use decorateWithCtxErr, after, and gerrors |
Comments suppressed due to low confidence (4)
cmd/root.go:4
- The import "cmp" does not exist in the standard library. If you need an Or helper for strings, consider importing the correct package or implement a small helper locally (e.g.,
func or(a, b string) string { if a != "" { return a }; return b }).
"cmp"
cmd/check.go:10
- This file uses
fmt.Errorfanderrors.Newbut does not import "fmt" or "errors". Add these imports to avoid undefined identifier errors.
"github.com/goreleaser/goreleaser/v2/internal/gerrors"
cmd/release.go:104
decorateWithCtxErrandafterare defined incmd/root.gobut not visible here. You need to either define them in this file or move them to a shared utility thatcmd/release.gocan import.
return decorateWithCtxErr(parent, err, "release", after(start))
cmd/build.go:122
decorateWithCtxErrandafterare not defined in this file. Either define these helpers here or extract them to a shared package so bothbuild.goandrelease.gocan access them.
return decorateWithCtxErr(parent, err, "build", after(start))
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Deploying goreleaser with
|
| Latest commit: |
9f899a0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c0d6efb9.goreleaser.pages.dev |
| Branch Preview URL: | https://errhandling.goreleaser.pages.dev |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5878 +/- ##
==========================================
- Coverage 82.76% 82.71% -0.05%
==========================================
Files 165 165
Lines 16526 16521 -5
==========================================
- Hits 13677 13666 -11
- Misses 2258 2262 +4
- Partials 591 593 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gerrorspackage