Skip to content

Update golangci-lint to v2.6.2#225

Merged
ReneWerner87 merged 6 commits into
masterfrom
codex/2025-11-21-09-22-19
Nov 21, 2025
Merged

Update golangci-lint to v2.6.2#225
ReneWerner87 merged 6 commits into
masterfrom
codex/2025-11-21-09-22-19

Conversation

@ReneWerner87
Copy link
Copy Markdown
Member

@ReneWerner87 ReneWerner87 commented Nov 21, 2025

Summary

  • update the CI lint workflow to run golangci-lint v2.6.2
  • bump the Makefile lint target to golangci-lint v2.6.2

Testing

  • make lint
  • make test

Codex Task

Summary by CodeRabbit

  • Chores
    • Updated the code linting tool to a newer version for development environment improvements.
  • Refactor
    • Internal package/namespace cleanup and small readability improvements.
    • Introduced a small helper to centralize identifier checks.
  • Bug Fixes
    • Added safe defaults to some decision branches to skip unrecognized items gracefully.
  • Tests
    • Updated tests to use context-aware process spawning and more idiomatic assertions.

✏️ Tip: You can customize this high-level summary in your review settings.

@ReneWerner87 ReneWerner87 requested a review from a team as a code owner November 21, 2025 09:22
@ReneWerner87 ReneWerner87 requested review from efectn, gaby and sixcolors and removed request for a team November 21, 2025 09:22
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on upgrading the project's linting infrastructure by updating the golangci-lint tool to version v2.6.2. This ensures that all code quality checks, both locally via the Makefile and within the CI pipeline, are performed using the latest version of the linter, potentially introducing new checks or performance improvements.

Highlights

  • CI Lint Workflow Update: The continuous integration lint workflow has been updated to use golangci-lint version v2.6.2.
  • Makefile Lint Target Bump: The lint target within the Makefile now invokes golangci-lint version v2.6.2.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/linter.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to update the version of golangci-lint. My review found a critical issue in the Makefile where a missing tab indentation for the lint target's command will cause make to fail. Additionally, the pull request description mentions updating the CI lint workflow, but the corresponding file changes appear to be missing from this pull request.

Comment thread Makefile Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Makefile Outdated
Comment thread Makefile Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 21, 2025

Warning

Rate limit exceeded

@ReneWerner87 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ffaa0bb and f19a02d.

📒 Files selected for processing (1)
  • cmd/migrate_test.go (5 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Multiple small refactors and test improvements across the repo: a Makefile golangci-lint version bump; several tests and helpers switched from exec.Command to exec.CommandContext; package rename for files under cmd/fileserver/app; multiple v3 migration parser/identifier helper cleanups; minor switch/simplification edits and a handful of test assertion refinements.

Changes

Cohort / File(s) Change Summary
Makefile lint update
Makefile
Bumps golangci-lint invocation from v1.62.0 to v2.6.2 in the lint target (command path unchanged).
Context-aware command usage in tests
cmd/dev_test.go, cmd/migrate_test.go, cmd/tester_test.go, cmd/internal/migrations/exec_stub_test.go
Replaced exec.Command(...) with exec.CommandContext(context.Background(), ...) or exec.CommandContext(e.ctx, ...) and added context imports where needed to make subprocess invocation cancellable.
Package rename — fileserver app
cmd/fileserver/app/app.go, cmd/fileserver/app/app_test.go
Changed package declaration from package fileserver to package app in both files.
v3 migrations: identifier parsing & parser mapping
cmd/internal/migrations/v3/common.go, cmd/internal/migrations/v3/add_method.go, cmd/internal/migrations/v3/listen_methods.go, cmd/internal/migrations/v3/parser_methods.go, cmd/internal/migrations/v3/config_listener_fields.go
Introduced isIdentifierChar helper and replaced repeated ASCII-range checks with calls to it; unified/simplified parser switch cases (moved ParamsParser under AllParams mapping), added small switch default/no-op branches and equivalent logical-condition rewrites.
Switch / control-flow small edits
cmd/migrate.go, cmd/root.go
Added explicit default cases in switches to continue/skip unrecognized items (no behavioral change aside from making skip explicit).
Test assertions & minor simplifications
cmd/internal/migrations/lists_test.go, cmd/root_test.go, cmd/prompt.go
Replaced assert.Equal(..., "") with assert.Empty(...); consolidated multiple key-case branches into a multi-value case in prompt update; minor test assertion tweak for version non-empty.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Test as Test/Subtest
  participant Ctx as context.Context
  participant Cmd as exec.CommandContext
  participant Proc as Subprocess

  Note over Test,Ctx: New pattern: create a cancellable command with context
  Test->>Cmd: exec.CommandContext(Ctx, "binary", args...)
  Cmd-->>Proc: spawn subprocess bound to Ctx
  alt cancel or timeout
    Ctx->>Proc: cancel -> subprocess terminated
    Proc-->>Test: returns cancelled/error
  else normal completion
    Proc-->>Test: returns exit success
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay extra attention to:
    • cmd/internal/migrations/v3/* changes (identifier logic and parser mapping) for correctness and edge cases.
    • Package rename in cmd/fileserver/app/* to ensure build/test imports and visibility are correct.
    • Replacements of exec.Commandexec.CommandContext to confirm correct contexts are used and no goroutine leaks occur.
    • Makefile lint version bump may require verifying CI/test tooling compatibility.

Possibly related PRs

Poem

🐇 I hopped through code both old and new,

Swapped commands for contexts true,
Made parsers tidy, switches neat,
A lint bump tuned the dev suite.
— Happy nibble, CodeRabbit 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.17% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the primary change in the changeset: updating golangci-lint to v2.6.2, which is the main file-level modification in the Makefile.
Description check ✅ Passed The description explains the changes (CI workflow and Makefile updates) and includes testing steps, but lacks detailed explanation of why this update is necessary or what problems it solves.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2914963 and ffaa0bb.

⛔ Files ignored due to path filters (1)
  • .golangci.yml is excluded by !**/*.yml
📒 Files selected for processing (17)
  • Makefile (1 hunks)
  • cmd/dev_test.go (5 hunks)
  • cmd/fileserver/app/app.go (1 hunks)
  • cmd/fileserver/app/app_test.go (1 hunks)
  • cmd/internal/migrations/exec_stub_test.go (2 hunks)
  • cmd/internal/migrations/lists_test.go (1 hunks)
  • cmd/internal/migrations/v3/add_method.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (6 hunks)
  • cmd/internal/migrations/v3/config_listener_fields.go (2 hunks)
  • cmd/internal/migrations/v3/listen_methods.go (1 hunks)
  • cmd/internal/migrations/v3/parser_methods.go (2 hunks)
  • cmd/internal/prompt.go (1 hunks)
  • cmd/migrate.go (1 hunks)
  • cmd/migrate_test.go (5 hunks)
  • cmd/root.go (1 hunks)
  • cmd/root_test.go (1 hunks)
  • cmd/tester_test.go (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • cmd/internal/migrations/v3/config_listener_fields.go
  • cmd/root_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.

Applied to files:

  • cmd/fileserver/app/app_test.go
📚 Learning: 2025-02-12T11:24:31.153Z
Learnt from: ReneWerner87
Repo: gofiber/storage PR: 0
File: :0-0
Timestamp: 2025-02-12T11:24:31.153Z
Learning: The storage package in gofiber/storage repository can be used independently of the Fiber web framework.

Applied to files:

  • cmd/fileserver/app/app_test.go
  • cmd/fileserver/app/app.go
📚 Learning: 2025-09-18T00:32:59.671Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 0
File: :0-0
Timestamp: 2025-09-18T00:32:59.671Z
Learning: In Go 1.22, manual copying of loop variables (like `x := x`) is no longer necessary due to the fix for variable capture in closures. Each loop iteration now creates its own instance of the loop variable automatically.

Applied to files:

  • cmd/root.go
📚 Learning: 2024-11-23T19:50:06.387Z
Learnt from: norri
Repo: gofiber/recipes PR: 2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.

Applied to files:

  • cmd/migrate_test.go
  • cmd/internal/migrations/exec_stub_test.go
📚 Learning: 2024-10-02T23:03:31.727Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.

Applied to files:

  • cmd/internal/migrations/exec_stub_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.

Applied to files:

  • cmd/internal/migrations/exec_stub_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build (1.25.x, macos-13)
  • GitHub Check: Build (1.25.x, windows-latest)
  • GitHub Check: Build (1.25.x, macos-latest)
  • GitHub Check: lint
🔇 Additional comments (17)
cmd/internal/prompt.go (1)

84-86: LGTM! Clean consolidation of duplicate case branches.

Combining the three key handlers into a single case statement is idiomatic Go and reduces duplication while maintaining identical behavior.

cmd/internal/migrations/lists_test.go (1)

30-30: LGTM: Improved test assertion.

Using assert.Empty is more idiomatic than assert.Equal(t, "", ...) for checking emptiness. This provides clearer intent and better error messages when the assertion fails.

cmd/internal/migrations/exec_stub_test.go (1)

4-4: LGTM! Context-aware command execution.

The update to use exec.CommandContext with context.Background() enables proper cancellation and timeout support in test helpers, which is a good practice.

Also applies to: 22-22

cmd/root.go (1)

55-56: LGTM! Explicit default case for switch exhaustiveness.

The explicit default: continue makes the switch statement exhaustive without changing behavior, which likely satisfies the updated linter requirements.

cmd/migrate_test.go (1)

4-4: LGTM! Consistent context-aware command execution.

All test helpers now use exec.CommandContext with appropriate contexts, enabling proper cancellation support throughout the test suite. The pattern is applied consistently across all command spawning locations.

Also applies to: 45-45, 219-219, 277-277, 303-303

cmd/migrate.go (1)

167-168: LGTM! Explicit handling of unrecognized entries.

The explicit default: continue case makes the switch exhaustive and clearly documents that unrecognized third-party entries are skipped, which aligns with the updated linter requirements.

cmd/dev_test.go (2)

71-71: LGTM! Excellent use of cancellable context.

Using e.ctx (the escort's cancellable context) is better than context.Background() as it enables proper cleanup when the escort is terminated. This is a good improvement for test reliability.

Also applies to: 86-86


238-296: LGTM! Improved test readability.

The refactoring from positional to named fields (op and bool) makes the test cases more readable and maintainable. The changes are consistent across all three test functions (Test_Dev_IsRemoved, Test_Dev_IsCreated, Test_Dev_IsChmoded).

cmd/tester_test.go (1)

5-5: LGTM! Context-aware test helper.

The test helper now uses exec.CommandContext, which is consistent with the updates across other test files in this PR and enables proper cancellation support.

Also applies to: 28-28

cmd/internal/migrations/v3/common.go (3)

15-17: LGTM! Good helper extraction.

The isIdentifierChar helper function improves code consistency and is now reused across multiple migration files (add_method.go, listen_methods.go, parser_methods.go), reducing duplication.


41-41: LGTM! Equivalent transformation.

The change from !(src[i] != '*' || src[i+1] != '/') to (src[i] == '*' && src[i+1] == '/') is a correct De Morgan's law transformation that improves readability while maintaining identical behavior.


141-141: LGTM! Switch exhaustiveness improvements.

The explicit empty default cases in these switches satisfy linter exhaustiveness checks without changing behavior, as the code already handled all relevant cases before falling through.

Also applies to: 246-246, 287-287, 328-328

cmd/internal/migrations/v3/listen_methods.go (1)

41-41: LGTM! Consistent use of shared helper.

Using the isIdentifierChar helper from common.go improves consistency across the migration codebase and reduces duplication of the identifier character check logic.

cmd/internal/migrations/v3/add_method.go (1)

38-44: LGTM! Clean refactor to centralize identifier validation.

The replacement of explicit character range checks with isIdentifierChar(ch) improves code maintainability and consistency across the v3 migration helpers.

cmd/internal/migrations/v3/parser_methods.go (2)

38-45: LGTM! Consistent identifier validation refactor.

Same clean refactor as in add_method.go, using the centralized isIdentifierChar helper.


50-62: LGTM! Switch simplification with good defensive practices.

The consolidation of ParamsParser with AllParams (both mapping to .Bind().URI() simplifies the code. The added default case provides a safety net, even though it's unreachable with the current regex pattern—this is good defensive programming in case the regex is modified in the future.

cmd/fileserver/app/app_test.go (1)

1-1: LGTM! Package rename aligns with source.

The test package correctly updated to match the source package rename in app.go.

Comment thread cmd/fileserver/app/app.go
@ReneWerner87 ReneWerner87 merged commit ed7eadc into master Nov 21, 2025
11 of 13 checks passed
@ReneWerner87 ReneWerner87 deleted the codex/2025-11-21-09-22-19 branch November 21, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant