Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove more calls to pkg errors #12683

Conversation

MoritzThomasHuebner
Copy link
Contributor

@MoritzThomasHuebner MoritzThomasHuebner commented May 11, 2022

refactor: Remove more calls to pkg errors

Summary

Also contains the changes of #12682

Removes additional uses of "github.com/pkg/errors" so that it is no longer a dependency.

  1. Removes the use of errors.WithStack(err) with err
  2. Removes the use of errors.WithMessage(err, mess) and errors.WithMessagef(err, mess, ...var) with fmt.Errorf(mess + ": %w", ...var, err)
  3. Replaces errors.Cause from "github.com/pkg/errors" with errors.Unwrap from GO "errors" package
  4. Replaces "github.com/pkg/errors" with GO "errors" package for errors.New

This PR also reformats a few comment strings where they were not correctly formatted before. Additionally, the PR also rearranges some unrelated imports where they weren't following the correct convention before.

Test Plan

Run Unit tests.

Additional Information

This PR removes the dependency on "github.com/pkg/errors".

  • This change is backwards-breaking

@pull-request-size pull-request-size bot added the size/XXL Denotes a Pull Request that changes 1000+ lines. label May 11, 2022
@github-actions
Copy link
Contributor

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added component: cwf component: feg FEG-gateway related issues component: orc8r Orchestrator-related issue labels May 11, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2022

Oops! Looks like you failed the Semantic PR check.

Howto

♻️ Updated: ✅ The check is passing the Semantic PR after the last commit.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2022

feg-workflow

    2 files  202 suites   37s ⏱️
371 tests 371 ✔️ 0 💤 0
385 runs  385 ✔️ 0 💤 0

Results for commit 8c633c2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2022

cloud-workflow

    1 files    98 suites   1m 5s ⏱️
343 tests 322 ✔️ 0 💤 21

For more details on these failures, see this check.

Results for commit 8c633c2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2022

agw-workflow

     77 files     122 suites   7m 11s ⏱️
1 162 tests 1 153 ✔️ 9 💤 0
1 163 runs  1 154 ✔️ 9 💤 0

Results for commit 8c633c2.

♻️ This comment has been updated with latest results.

@MoritzThomasHuebner MoritzThomasHuebner changed the title Remove more calls to pkg errors refactor: remove more calls to pkg errors May 11, 2022
@MoritzThomasHuebner MoritzThomasHuebner changed the title refactor: remove more calls to pkg errors refactor: Remove more calls to pkg errors May 11, 2022
@MoritzThomasHuebner MoritzThomasHuebner force-pushed the remove_more_calls_to_pkg_errors branch 4 times, most recently from 1a7de55 to 5ecc9d1 Compare May 12, 2022 06:46
@MoritzThomasHuebner MoritzThomasHuebner force-pushed the remove_more_calls_to_pkg_errors branch 3 times, most recently from 8c633c2 to 724a755 Compare May 16, 2022 00:21
Also added back in a nil check in `collectGarbageSQL` in `orc8r/clound/go/syncstore/store_writer.go`

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Also added back in a nil check in `collectGarbageSQL` in `orc8r/clound/go/syncstore/store_writer.go`

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Also added back in a nil check in `collectGarbageSQL` in `orc8r/clound/go/syncstore/store_writer.go`

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
…errors" package

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
…kg/errors" as direct dependency.

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Previously the error handling blocks used `err` instead of `commitErr`. This meant that `nil` was propagated up instead of the `commitErr`. Additionally, we now append the `rollbackErr` to the error, which not previously done.

Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
@MoritzThomasHuebner MoritzThomasHuebner deleted the remove_more_calls_to_pkg_errors branch May 18, 2022 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: cwf component: feg FEG-gateway related issues component: orc8r Orchestrator-related issue size/XXL Denotes a Pull Request that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant