Skip to content

refactor: replace errgo and pkg/errors with github.com/Scalingo/go-utils/errors/v3#1196

Merged
EtienneM merged 10 commits intomasterfrom
build/remove_errgo
Mar 5, 2026
Merged

refactor: replace errgo and pkg/errors with github.com/Scalingo/go-utils/errors/v3#1196
EtienneM merged 10 commits intomasterfrom
build/remove_errgo

Conversation

@EtienneM
Copy link
Member

@EtienneM EtienneM commented Mar 4, 2026

  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

@EtienneM EtienneM self-assigned this Mar 4, 2026
@EtienneM EtienneM changed the base branch from master to feat/pagination/json_tag March 4, 2026 07:33
@EtienneM EtienneM force-pushed the build/remove_errgo branch from c3fbc95 to 09876a8 Compare March 4, 2026 09:39
@EtienneM EtienneM force-pushed the build/remove_errgo branch from 5fd4404 to 5477e2b Compare March 4, 2026 10:08
@EtienneM EtienneM force-pushed the feat/pagination/json_tag branch 2 times, most recently from c8add97 to 5c42416 Compare March 4, 2026 16:24
Base automatically changed from feat/pagination/json_tag to master March 4, 2026 16:56
@EtienneM EtienneM force-pushed the build/remove_errgo branch from 70613aa to d5fd770 Compare March 5, 2026 08:01
@EtienneM EtienneM marked this pull request as ready for review March 5, 2026 08:07
@EtienneM EtienneM requested a review from a team as a code owner March 5, 2026 08:07
@EtienneM EtienneM requested review from SCedricThomas and removed request for a team March 5, 2026 08:07
Copy link
Contributor

@SCedricThomas SCedricThomas left a comment

Choose a reason for hiding this comment

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

Just some questions and fix to make. Thanks for taking care of this

env/display.go Outdated
}
}
return "", errors.New("environment variable not found")
return "", stderrors.New("environment variable not found")
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: you should use the go-utils/error/v3 package as you have access to a context

return errors.Wrapf(ctx, err, "error parsing hours")
}
if i < 0 {
return stderrors.New("must be positive")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: can we use go-utils/error/v3 errors here? I saw that we are capturing the parent scope context but it should be possible as you used it to call errors.Wrapf on line 506

return func(ans any) error {
str, ok := ans.(string)
if !ok {
return stderrors.New("must be a string")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: can we use go-utils/error/v3 errors here? I saw that we are capturing the parent scope context but it should be possible as you used it to call errors.Wrapf on line 506

var params scalingo.SCMRepoLinkCreateParams
if config.C.DisableInteractive {
return params, errors.New("need at least one integration link parameter")
return params, stderrors.New("need at least one integration link parameter")
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: you should use the go-utils/errors/v3 package here

noAutoDeploy := c.Bool("no-auto-deploy")
if autoDeploy && noAutoDeploy {
errorQuitWithHelpMessage(ctx, errors.New("cannot define both auto-deploy and no-auto-deploy"), c, "integration-link-update")
errorQuitWithHelpMessage(ctx, stderrors.New("cannot define both auto-deploy and no-auto-deploy"), c, "integration-link-update")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? We have access to a context


if allowReviewAppsFromForks && noAllowReviewAppsFromForks {
errorQuitWithHelpMessage(ctx, errors.New("cannot define both allow-review-apps-from-forks and no-allow-review-apps-from-forks"), c, "integration-link-update")
errorQuitWithHelpMessage(ctx, stderrors.New("cannot define both allow-review-apps-from-forks and no-allow-review-apps-from-forks"), c, "integration-link-update")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? We have access to a context


if awareOfSecurityRisks && !c.IsSet("allow-review-apps-from-forks") {
errorQuitWithHelpMessage(ctx, errors.New("flag --aware-of-security-risks must be used in conjunction with --allow-review-apps-from-forks"), c, "integration-link-update")
errorQuitWithHelpMessage(ctx, stderrors.New("flag --aware-of-security-risks must be used in conjunction with --allow-review-apps-from-forks"), c, "integration-link-update")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? We have access to a context


if awareOfSecurityRisks && !c.IsSet("allow-review-apps-from-forks") {
errorQuitWithHelpMessage(ctx, errors.New("flag --aware-of-security-risks must be used in conjunction with --allow-review-apps-from-forks"), c, "integration-link-create")
errorQuitWithHelpMessage(ctx, stderrors.New("flag --aware-of-security-risks must be used in conjunction with --allow-review-apps-from-forks"), c, "integration-link-create")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? We have access to a context


if allowReviewAppsFromForks && noAllowReviewAppsFromForks {
errorQuitWithHelpMessage(ctx, errors.New("cannot define both allow-review-apps-from-forks and no-allow-review-apps-from-forks"), c, "integration-link-create")
errorQuitWithHelpMessage(ctx, stderrors.New("cannot define both allow-review-apps-from-forks and no-allow-review-apps-from-forks"), c, "integration-link-create")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? We have access to a context

noDestroyOnStale := c.Bool("no-destroy-on-stale")
if destroyOnStale && noDestroyOnStale {
errorQuitWithHelpMessage(ctx, errors.New("cannot define both destroy-on-stale and no-destroy-on-stale"), c, "integration-link-create")
errorQuitWithHelpMessage(ctx, stderrors.New("cannot define both destroy-on-stale and no-destroy-on-stale"), c, "integration-link-create")
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why not using go-utils/errors/v3 package here? Same for above

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, I fixed all your comments in b662bda

@EtienneM EtienneM requested a review from SCedricThomas March 5, 2026 10:27
@EtienneM EtienneM merged commit a901590 into master Mar 5, 2026
7 checks passed
@EtienneM EtienneM deleted the build/remove_errgo branch March 5, 2026 13:35
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