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: add depguard config for linter #337

Merged
merged 1 commit into from
Jun 6, 2023
Merged

chore: add depguard config for linter #337

merged 1 commit into from
Jun 6, 2023

Conversation

rainest
Copy link
Collaborator

@rainest rainest commented Jun 5, 2023

See https://github.com/Kong/go-kong/actions/runs/5171929210/jobs/9315785132?pr=333 for example problem.

golangci-lint version 1.53 upgraded the depguard linter from v1 to v2. AFAICT v1's behavior with no configuration to allow all packages, whereas v2 apparently denies everything but the standard library and local files (unclear--I'm not sure where the defaults actually live and the depguard change logs do not mention this, but it appears to be the case from my testing). golangci/golangci-lint#3795 (comment) agrees but doesn't indicate the cause of the default change.

The presence of a denylist will instead deny only those packages and allow all others. The tests I can find in golangci-lint appear to all use a denylist and may be missing the default behavior, and it's possible nobody noticed the issue because it was masked by some other issue where depguard was preventing the linter from running at all :|

I don't entirely agree that this is a "reasonable" default and have half a mind to just remove it, but seeing as we need to make changes to the golangci-lint config either way, we may as well list some basic packages we should never include instead.

Edit: subsequently, I found that elsewhere we did remove it, and that we're also using gomodguard in some cases, which seems to provide nigh-identical functionality. Since we don't use the depguard globbing and gomodguard appears to maybe some additional features re suggestions, using that instead.

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (9bc15b0) 52.75% compared to head (cd01ce2) 52.75%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #337   +/-   ##
=======================================
  Coverage   52.75%   52.75%           
=======================================
  Files          69       69           
  Lines        5093     5093           
=======================================
  Hits         2687     2687           
  Misses       1832     1832           
  Partials      574      574           
Flag Coverage Δ
2.1.4 36.16% <ø> (ø)
2.2.1.3 46.65% <ø> (ø)
2.2.2 36.16% <ø> (ø)
2.3.3 36.32% <ø> (ø)
2.3.3.4 47.31% <ø> (ø)
2.4.1 36.40% <ø> (ø)
2.4.1.3 47.39% <ø> (ø)
2.5.1.2 47.39% <ø> (ø)
2.5.2 36.40% <ø> (ø)
2.6.1 36.40% <ø> (ø)
2.6.1.0 47.39% <ø> (ø)
2.7.2 36.40% <ø> (ø)
2.7.2.0 48.92% <ø> (ø)
2.8.3 36.40% <ø> (ø)
2.8.4.0 48.92% <ø> (ø)
3.0.2 35.85% <ø> (ø)
3.0.2.0 49.38% <ø> (ø)
3.1.1 37.34% <ø> (ø)
3.1.1.3 50.97% <ø> (ø)
3.2.2 37.40% <ø> (ø)
3.2.2.1 50.97% <ø> (ø)
community 37.95% <ø> (ø)
enterprise 51.52% <ø> (ø)
enterprise-nightly 50.97% <ø> (ø)
integration 52.75% <ø> (ø)
nightly 37.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rainest rainest merged commit 482d841 into main Jun 6, 2023
43 checks passed
@rainest rainest deleted the chore/linter-fix branch June 6, 2023 16:47
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

3 participants