Skip to content

Update golangci-lint and re-enable CI linting step#13343

Merged
brandond merged 29 commits intok3s-io:mainfrom
brandond:add-lint-validate
Dec 18, 2025
Merged

Update golangci-lint and re-enable CI linting step#13343
brandond merged 29 commits intok3s-io:mainfrom
brandond:add-lint-validate

Conversation

@brandond
Copy link
Copy Markdown
Member

@brandond brandond commented Dec 13, 2025

Proposed Changes

Apparently we have not been linting in CI since December 2023, as there are a large number of issues to fix. It was apparently intended for this to be a temporary measure to unblock the 1.29 release, but we never opened an issue to track re-enabling it, so it never got done.

Total issue count by rule, excluding the tests/ dir, and after excluding some rules that we are not ready to enforce:

     36 unnecessary-format
     29 redundant-build-tag
     27 use-errors-new
     21 use-any
     20 empty-lines
     19 comment-spacings
     10 unexported-naming
     10 indent-error-flow
      9 bare-return
      7 redefines-builtin-id
      6 unnecessary-stmt
      6 defer
      5 deep-exit
      4 unchecked-type-assertion
      4 if-return
      4 exported
      4 duplicated-imports
      4 dot-imports
      3 import-alias-naming
      3 bool-literal-in-expr
      2 unexported-return
      2 superfluous-else
      1 useless-break
      1 unhandled-error
      1 struct-tag
      1 identical-switch-branches
      1 get-return
      1 File is not properly formatted

Types of Changes

CI

Verification

Testing

Linked Issues

User-Facing Change

Further Comments

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond brandond requested a review from a team as a code owner December 13, 2025 01:49
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 13, 2025

Codecov Report

❌ Patch coverage is 24.04580% with 199 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.49%. Comparing base (c0b1314) to head (d2acbc3).
⚠️ Report is 46 commits behind head on main.

Files with missing lines Patch % Lines
pkg/agent/flannel/flannel.go 0.00% 18 Missing ⚠️
pkg/cluster/bootstrap.go 0.00% 17 Missing ⚠️
pkg/util/lru.go 45.83% 13 Missing ⚠️
pkg/cli/server/server.go 0.00% 10 Missing ⚠️
pkg/util/net.go 0.00% 7 Missing ⚠️
pkg/util/patch.go 0.00% 7 Missing ⚠️
pkg/vpn/vpn.go 0.00% 7 Missing ⚠️
pkg/agent/flannel/setup.go 0.00% 6 Missing ⚠️
pkg/agent/netpol/netpol.go 0.00% 6 Missing ⚠️
pkg/cgroups/cgroups_linux.go 0.00% 6 Missing ⚠️
... and 43 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13343      +/-   ##
==========================================
+ Coverage   21.42%   21.49%   +0.07%     
==========================================
  Files         187      188       +1     
  Lines       15296    15291       -5     
==========================================
+ Hits         3277     3287      +10     
+ Misses      11573    11558      -15     
  Partials      446      446              
Flag Coverage Δ
unittests 21.49% <24.04%> (+0.07%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brandond brandond force-pushed the add-lint-validate branch 2 times, most recently from 4424a2f to 2c1e97b Compare December 16, 2025 01:10
@brandond
Copy link
Copy Markdown
Member Author

brandond commented Dec 16, 2025

level=warning msg="[runner] Can't process results by diff processor: can't prepare diff by revgrep: could not read git repo: error executing \"git merge-base main HEAD\": exit status 128: fatal: Not a valid object name main\n"

I guess this doesn't work with a sparse checkout; I'll fix that. Seems like it falls back to just linting everything though.

`make validate` use to run in drone, move it into GHA

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond brandond force-pushed the add-lint-validate branch 2 times, most recently from c18ae6b to 0391e4b Compare December 16, 2025 19:16
@brandond brandond requested review from a team and dereknola December 16, 2025 19:27
@brandond brandond force-pushed the add-lint-validate branch 2 times, most recently from d6345e4 to 483cb8f Compare December 16, 2025 19:58
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Adds a generic wrapper around lru.Cache

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond brandond merged commit e44a77d into k3s-io:main Dec 18, 2025
92 of 93 checks passed
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.

4 participants