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

chore(*) enforce use of correct errors module #2624

Merged
merged 2 commits into from
Aug 24, 2021
Merged

chore(*) enforce use of correct errors module #2624

merged 2 commits into from
Aug 24, 2021

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Aug 23, 2021

Summary

There are a number of Go modules named errors and it is easy
for autocompletion to pick the wrong on, since they are all
similar. Remove github.com/go-errors/errors, since Kuma has
already standardized on github.com/pkg/errors. Add a linter
rule to prevent regressions.

Full changelog

N/A

Issues resolved

N/A

Documentation

N/A

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

Backwards compatibility

  • Add backport-to-stable label if the code is backwards compatible. Otherwise, list breaking changes.

@jpeach jpeach requested a review from a team as a code owner August 23, 2021 01:33
gomodguard:
blocked:
modules:
- github.com/go-errors/errors:
Copy link
Contributor

Choose a reason for hiding this comment

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

what about just errors module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, if there's consensus. Though it would prevent adopting APIs like errors.Is.

Copy link
Contributor

Choose a reason for hiding this comment

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

wait, do we want to block the standard errors module? why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wait, do we want to block the standard errors module? why?

It is not blocked in this PR. The question was whether we ought to block it.

Copy link
Contributor

Choose a reason for hiding this comment

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

why would we block it? We use errors.New all the time

Copy link
Contributor

Choose a reason for hiding this comment

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

errors.New is a function from pkg/errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeh, we use both versions.

There are a number of Go modules named `errors` and it is easy
for autocompletion to pick the wrong on, since they are all
similar. Remove `github.com/go-errors/errors`, since Kuma has
already standardized on `github.com/pkg/errors`. Add a linter
rule to prevent regressions.

Signed-off-by: James Peach <james.peach@konghq.com>
@codecov-commenter
Copy link

Codecov Report

Merging #2624 (8e390a2) into master (fd4bdd2) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2624      +/-   ##
==========================================
+ Coverage   52.07%   52.09%   +0.02%     
==========================================
  Files         877      877              
  Lines       49480    49480              
==========================================
+ Hits        25767    25777      +10     
+ Misses      21645    21633      -12     
- Partials     2068     2070       +2     
Impacted Files Coverage Δ
pkg/config/core/config.go 100.00% <ø> (ø)
.../core/managers/apis/dataplane/dataplane_manager.go 66.66% <ø> (ø)
test/e2e/deploy/kuma_deploy_global_zone.go 0.00% <ø> (ø)
test/e2e/deploy/kuma_deploy_universal.go 0.00% <ø> (ø)
test/e2e/helm/kuma_helm_deploy_global_zone.go 0.00% <ø> (ø)
test/framework/setup.go 1.17% <ø> (ø)
test/framework/universal_cluster.go 0.00% <ø> (ø)
pkg/core/resources/manager/cache.go 81.81% <0.00%> (-2.60%) ⬇️
pkg/xds/generator/direct_access_proxy_generator.go 82.75% <0.00%> (-1.15%) ⬇️
pkg/mads/server/server.go 84.82% <0.00%> (+1.78%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd4bdd2...8e390a2. Read the comment docs.

@bartsmykla bartsmykla merged commit 975fafa into kumahq:master Aug 24, 2021
mergify bot pushed a commit that referenced this pull request Aug 24, 2021
There are a number of Go modules named `errors` and it is easy
for autocompletion to pick the wrong on, since they are all
similar. Remove `github.com/go-errors/errors`, since Kuma has
already standardized on `github.com/pkg/errors`. Add a linter
rule to prevent regressions.

Signed-off-by: James Peach <james.peach@konghq.com>

Co-authored-by: Bart Smykla <bartek@smykla.com>
(cherry picked from commit 975fafa)

# Conflicts:
#	.golangci.yml
#	test/framework/setup.go
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.

None yet

6 participants