🐛 bug: fix gocritic httpNoBody and hugeParam issues#3855
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughThis PR converts many value parameters to pointer parameters, adds nil-safety and defensive copies where needed, standardizes empty-request tests to Changes
Sequence Diagram(s)%%{init: {"themeVariables": {"actorBackground":"#f6f8fa","actorBorder":"#d0d7de","noteBackground":"#fff8dc","noteBorder":"#e6d9a8"}}}%%
sequenceDiagram
participant App
participant Router
participant Hooks
participant RouteHandler as Route
Note over App,Router: Old flow (route value)
App->>Router: addRoute(route)
Router->>Hooks: executeOnRouteHooks(route)
Hooks->>RouteHandler: handlers receive route (value)
Note over App,Router: New flow (route pointer + clone)
App->>Router: addRoute(route)
Router->>Hooks: executeOnRouteHooks(&route)
Hooks->>Hooks: if route==nil -> return error (guard)
Hooks->>Hooks: cloned := *route
Hooks->>Hooks: apply mountPath / modifications to cloned
Hooks->>RouteHandler: pass cloned to handlers
Note over RouteHandler: original route remains unchanged
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Areas needing extra attention:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @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 enhancing code quality and performance by addressing specific Highlights
Using Gemini Code AssistThe 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
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 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
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3855 +/- ##
==========================================
- Coverage 92.11% 91.67% -0.44%
==========================================
Files 115 115
Lines 9776 9819 +43
==========================================
- Hits 9005 9002 -3
- Misses 490 517 +27
- Partials 281 300 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors function signatures across the codebase to accept pointer parameters instead of value parameters for structs, improving performance by avoiding unnecessary copying. The changes also standardize test code by replacing nil with http.NoBody for HTTP request bodies, and enhance linter configuration.
Key changes:
- Convert struct parameters to pointers in multiple functions (Colors, Route, Config types)
- Add nil checks and default value handling where appropriate
- Replace
nilwithhttp.NoBodyin test request creation - Enable additional gocritic linter tags for style and performance
Reviewed Changes
Copilot reviewed 66 out of 66 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services.go, services_test.go | Changed logServices to accept *Colors pointer, updated test call |
| router.go | Changed executeOnRouteHooks to accept *Route pointer |
| res.go, res_interface_gen.go, ctx_interface_gen.go | Changed getLocationFromRoute to accept *Route pointer with nil check |
| redirect.go | Updated to pass &route to getLocationFromRoute |
| prefork.go, prefork_test.go | Changed prefork to accept *ListenConfig pointer with nil check |
| listen.go, listen_test.go | Changed multiple functions to accept pointer parameters with nil checks |
| hooks.go, hooks_test.go | Changed executeOnRouteHooks/executeOnNameHooks to accept *Route pointer with cloning |
| color.go, app.go | Changed defaultColors to accept *Colors pointer with nil check |
| middleware/logger/*.go | Changed color functions to accept *Colors pointer with nil checks |
| middleware/session/*.go | Changed initialize to accept *Config pointer |
| middleware/limiter/*.go | Changed Handler.New to accept *Config pointer with nil checks |
| middleware/cors/*.go | Changed helper functions to accept *Config pointer with nil checks |
| middleware/csrf/*.go | Changed multiple functions to accept *Config pointer |
| middleware/proxy/*.go | Changed Balancer to accept variadic ...Config |
| middleware/basicauth/*.go | Changed New to accept variadic ...Config |
| binder/mapping.go | Changed isExported/fieldName to accept *reflect.StructField pointer |
| Multiple test files | Replaced nil with http.NoBody in test request creation |
| .golangci.yml | Added style and performance tags to gocritic configuration |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant refactoring to address gocritic linter warnings, specifically httpNoBody and hugeParam. The changes are extensive and touch many files, primarily replacing nil with http.NoBody in HTTP requests for tests and converting functions to accept pointers for large structs instead of values. These changes are well-executed and improve both code style and performance.
I've identified one potential issue where a nil check is insufficient, which could lead to a panic. I've left a comment with a suggestion to fix it. Overall, this is a great contribution to improving the codebase's quality.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
middleware/keyauth/keyauth_test.go (1)
136-144: Consider defaultingreqBodytohttp.NoBodyfor consistency.For consistency with the other changes in this PR, initialize
reqBodytohttp.NoBodyinstead of relying on thenilzero value:-var reqBody io.Reader +reqBody := http.NoBody if authSource == formExtractorName { form := url.Values{} form.Add(test.authTokenName, testKey) bodyStr := form.Encode() reqBody = strings.NewReader(bodyStr) }This makes the intent more explicit and aligns with the systematic replacement of
nilbodies throughout this file.middleware/logger/default_logger.go (1)
17-24: Nil-check adds safety, but changes behavior.The signature change to accept
*Configaligns with the PR objective. The nil-check with default initialization is defensive programming, but note that it changes behavior: previously a nilcfgwould panic (exposing caller bugs), now it silently uses defaults. SincedefaultLoggerInstanceis private, ensure all call sites pass a valid pointer—or document that nil is acceptable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
.golangci.ymlis excluded by!**/*.yml
📒 Files selected for processing (65)
adapter_test.go(3 hunks)app.go(2 hunks)app_test.go(47 hunks)bind_test.go(3 hunks)binder/mapping.go(2 hunks)color.go(1 hunks)ctx_interface_gen.go(1 hunks)ctx_test.go(49 hunks)extractors/extractors_test.go(1 hunks)hooks.go(1 hunks)hooks_test.go(3 hunks)listen.go(9 hunks)listen_test.go(4 hunks)middleware/adaptor/adaptor_test.go(9 hunks)middleware/basicauth/basicauth.go(1 hunks)middleware/basicauth/basicauth_test.go(20 hunks)middleware/cache/cache_test.go(56 hunks)middleware/compress/compress_test.go(30 hunks)middleware/cors/cors.go(4 hunks)middleware/cors/cors_test.go(2 hunks)middleware/csrf/config.go(1 hunks)middleware/csrf/csrf.go(8 hunks)middleware/csrf/csrf_test.go(11 hunks)middleware/earlydata/earlydata_test.go(6 hunks)middleware/encryptcookie/encryptcookie_test.go(4 hunks)middleware/envvar/envvar_test.go(7 hunks)middleware/etag/etag_test.go(9 hunks)middleware/expvar/expvar_test.go(6 hunks)middleware/favicon/favicon_test.go(7 hunks)middleware/healthcheck/healthcheck_test.go(3 hunks)middleware/helmet/helmet_test.go(8 hunks)middleware/idempotency/idempotency_test.go(11 hunks)middleware/keyauth/keyauth_test.go(30 hunks)middleware/limiter/limiter.go(2 hunks)middleware/limiter/limiter_fixed.go(1 hunks)middleware/limiter/limiter_sliding.go(1 hunks)middleware/limiter/limiter_test.go(32 hunks)middleware/logger/config.go(1 hunks)middleware/logger/default_logger.go(3 hunks)middleware/logger/logger.go(2 hunks)middleware/logger/logger_test.go(31 hunks)middleware/logger/tags.go(1 hunks)middleware/logger/utils.go(2 hunks)middleware/pprof/pprof_test.go(11 hunks)middleware/proxy/proxy.go(2 hunks)middleware/proxy/proxy_test.go(34 hunks)middleware/recover/recover_test.go(4 hunks)middleware/redirect/redirect_test.go(9 hunks)middleware/requestid/requestid_test.go(4 hunks)middleware/rewrite/rewrite_test.go(5 hunks)middleware/session/middleware.go(3 hunks)middleware/skip/skip_test.go(4 hunks)middleware/static/static_test.go(48 hunks)middleware/timeout/timeout_test.go(8 hunks)mount_test.go(17 hunks)prefork.go(1 hunks)prefork_test.go(4 hunks)redirect.go(1 hunks)redirect_test.go(4 hunks)res.go(2 hunks)res_interface_gen.go(1 hunks)router.go(2 hunks)router_test.go(41 hunks)services.go(1 hunks)services_test.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Apply formatting using gofumpt (Make target: format)
Optimize struct field alignment using betteralign (Make target: betteralign)
Modernize code using gopls modernize (Make target: modernize)
Files:
middleware/pprof/pprof_test.gomiddleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.gomiddleware/logger/tags.gores_interface_gen.gomiddleware/basicauth/basicauth.gomiddleware/proxy/proxy.gomiddleware/csrf/config.gomiddleware/healthcheck/healthcheck_test.gomiddleware/envvar/envvar_test.goredirect_test.gomiddleware/logger/utils.gomiddleware/earlydata/earlydata_test.goctx_test.gores.goprefork.goadapter_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/adaptor/adaptor_test.goprefork_test.gomiddleware/requestid/requestid_test.gohooks.gomiddleware/expvar/expvar_test.gomiddleware/limiter/limiter.gomiddleware/logger/config.gorouter_test.gohooks_test.gomiddleware/timeout/timeout_test.gomiddleware/cors/cors_test.goapp_test.goapp.gobind_test.gomiddleware/compress/compress_test.golisten_test.goctx_interface_gen.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomiddleware/rewrite/rewrite_test.gomount_test.goservices.gomiddleware/redirect/redirect_test.gomiddleware/session/middleware.gocolor.goredirect.golisten.gomiddleware/idempotency/idempotency_test.goservices_test.gomiddleware/csrf/csrf.gomiddleware/limiter/limiter_sliding.gomiddleware/etag/etag_test.goextractors/extractors_test.gomiddleware/limiter/limiter_fixed.gomiddleware/cors/cors.gobinder/mapping.gomiddleware/static/static_test.gorouter.gomiddleware/logger/logger.gomiddleware/logger/default_logger.gomiddleware/skip/skip_test.gomiddleware/csrf/csrf_test.go
🧠 Learnings (22)
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:19:52.418Z
Learning: In the Fiber codebase, the linter does not allow `require` assertions from within HTTP handlers (including net/http-style handlers). Use `t.Fatalf`, `t.Errorf`, or similar `testing.T` methods for error handling inside handler functions instead.
Applied to files:
middleware/pprof/pprof_test.gomiddleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.gomiddleware/healthcheck/healthcheck_test.gomiddleware/envvar/envvar_test.goredirect_test.gomiddleware/earlydata/earlydata_test.goctx_test.goadapter_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/adaptor/adaptor_test.gomiddleware/requestid/requestid_test.gomiddleware/expvar/expvar_test.gorouter_test.gomiddleware/timeout/timeout_test.gomiddleware/cors/cors_test.goapp_test.gobind_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomiddleware/rewrite/rewrite_test.gomount_test.gomiddleware/redirect/redirect_test.gomiddleware/idempotency/idempotency_test.gomiddleware/etag/etag_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.gomiddleware/csrf/csrf_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:
middleware/pprof/pprof_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/healthcheck/healthcheck_test.gomiddleware/earlydata/earlydata_test.goctx_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/requestid/requestid_test.gomiddleware/expvar/expvar_test.gorouter_test.gomiddleware/timeout/timeout_test.gomiddleware/cors/cors_test.goapp_test.gobind_test.gomiddleware/compress/compress_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomount_test.gomiddleware/etag/etag_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.go
📚 Learning: 2024-09-25T16:18:34.719Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:122-122
Timestamp: 2024-09-25T16:18:34.719Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.
Applied to files:
middleware/pprof/pprof_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.gomiddleware/logger/tags.gomiddleware/adaptor/adaptor_test.gomiddleware/expvar/expvar_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/rewrite/rewrite_test.gomount_test.gomiddleware/redirect/redirect_test.gomiddleware/idempotency/idempotency_test.gomiddleware/etag/etag_test.gomiddleware/logger/default_logger.gomiddleware/csrf/csrf_test.go
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:15:26.529Z
Learning: In Fiber v3, net/http handlers (http.Handler, http.HandlerFunc, or raw func(http.ResponseWriter, *http.Request)) can be passed directly to routing methods like app.Get(), app.Post(), etc. The framework automatically detects and wraps them internally via toFiberHandler/collectHandlers. The github.com/gofiber/fiber/v3/middleware/adaptor package is legacy and should not be suggested for tests or code using native net/http handler support.
Applied to files:
middleware/pprof/pprof_test.gomiddleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.gomiddleware/basicauth/basicauth.gomiddleware/envvar/envvar_test.gomiddleware/earlydata/earlydata_test.goctx_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/adaptor/adaptor_test.gomiddleware/requestid/requestid_test.gomiddleware/expvar/expvar_test.gomiddleware/limiter/limiter.gomiddleware/logger/config.gorouter_test.gomiddleware/timeout/timeout_test.gomiddleware/cors/cors_test.goapp_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomiddleware/rewrite/rewrite_test.gomount_test.gomiddleware/redirect/redirect_test.gomiddleware/idempotency/idempotency_test.gomiddleware/etag/etag_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.gomiddleware/csrf/csrf_test.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:
middleware/pprof/pprof_test.gomiddleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.gomiddleware/logger/utils.gomiddleware/earlydata/earlydata_test.goctx_test.goadapter_test.gomiddleware/adaptor/adaptor_test.goprefork_test.gomiddleware/requestid/requestid_test.gohooks_test.gomiddleware/timeout/timeout_test.gomiddleware/cors/cors_test.gomiddleware/compress/compress_test.golisten_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomiddleware/rewrite/rewrite_test.gomount_test.gomiddleware/redirect/redirect_test.gomiddleware/etag/etag_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/csrf_test.go:188-193
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the Fiber framework tests, using `ctx.Response.Header.Cookie` may not be suitable for parsing cookies from the response header, as it requires a `*Cookie` and fills it rather than returning a string value; thus, manual parsing of the `Set-Cookie` header may be necessary.
Applied to files:
middleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/proxy/proxy_test.goredirect_test.gomiddleware/earlydata/earlydata_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/adaptor/adaptor_test.gomiddleware/expvar/expvar_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomiddleware/redirect/redirect_test.gomiddleware/static/static_test.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Applied to files:
middleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/healthcheck/healthcheck_test.gomiddleware/earlydata/earlydata_test.goctx_test.gomiddleware/adaptor/adaptor_test.gomiddleware/requestid/requestid_test.gorouter_test.goapp_test.gobind_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/redirect/redirect_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Applied to files:
middleware/favicon/favicon_test.gomiddleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/recover/recover_test.gomiddleware/limiter/limiter_test.gomiddleware/healthcheck/healthcheck_test.gomiddleware/earlydata/earlydata_test.goctx_test.gomiddleware/encryptcookie/encryptcookie_test.gomiddleware/requestid/requestid_test.gomiddleware/expvar/expvar_test.gorouter_test.gomiddleware/timeout/timeout_test.goapp_test.gobind_test.gomiddleware/compress/compress_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/helmet/helmet_test.gomount_test.gomiddleware/redirect/redirect_test.gomiddleware/etag/etag_test.gomiddleware/static/static_test.gomiddleware/skip/skip_test.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-11-29T12:37:27.581Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: app_test.go:893-895
Timestamp: 2024-11-29T12:37:27.581Z
Learning: In the `Test_App_ShutdownWithContext` function in `app_test.go`, the `clientDone` channel is used to synchronize the client's request completion before proceeding, eliminating the need for additional `time.Sleep` calls.
Applied to files:
middleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/limiter/limiter_test.gomiddleware/proxy/proxy_test.goctx_test.gomiddleware/requestid/requestid_test.gorouter_test.gomiddleware/timeout/timeout_test.goapp_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomount_test.golisten.gomiddleware/static/static_test.go
📚 Learning: 2024-09-25T17:05:06.991Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/middleware_test.go:190-191
Timestamp: 2024-09-25T17:05:06.991Z
Learning: When testing session `IdleTimeout` expiration, it's acceptable to use `time.Sleep` to simulate the passage of time in tests.
Applied to files:
middleware/cache/cache_test.gomiddleware/logger/logger_test.gomiddleware/proxy/proxy_test.gomiddleware/timeout/timeout_test.goapp_test.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Applied to files:
middleware/logger/logger_test.gomiddleware/envvar/envvar_test.gomiddleware/adaptor/adaptor_test.gomiddleware/requestid/requestid_test.gomiddleware/timeout/timeout_test.gomiddleware/keyauth/keyauth_test.gomiddleware/basicauth/basicauth_test.gomiddleware/rewrite/rewrite_test.gomiddleware/redirect/redirect_test.goextractors/extractors_test.go
📚 Learning: 2025-05-08T08:14:37.302Z
Learnt from: mdelapenya
Repo: gofiber/fiber PR: 3434
File: app.go:623-636
Timestamp: 2025-05-08T08:14:37.302Z
Learning: In the gofiber/fiber framework, service startup failures should panic rather than allowing the application to continue running with degraded functionality, as this is the agreed-upon design decision.
Applied to files:
middleware/recover/recover_test.go
📚 Learning: 2025-07-27T17:28:53.403Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3625
File: middleware/session/config.go:57-58
Timestamp: 2025-07-27T17:28:53.403Z
Learning: In the session middleware `Config` struct, the `Extractor` field uses function closures (like `FromCookie(key)`), making it impossible to introspect extractor parameters at runtime for validation purposes without complex reflection techniques.
Applied to files:
middleware/csrf/config.gomiddleware/csrf/csrf.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3056
File: middleware/encryptcookie/utils.go:22-25
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `encryptcookie_test.go` file contains unit tests that validate key lengths for both `EncryptCookie` and `DecryptCookie` functions, ensuring that invalid key lengths raise appropriate errors.
Applied to files:
middleware/encryptcookie/encryptcookie_test.go
📚 Learning: 2024-07-01T03:44:03.672Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3056
File: middleware/encryptcookie/utils.go:20-23
Timestamp: 2024-07-01T03:44:03.672Z
Learning: Unit tests for key length enforcement in both `EncryptCookie` and `DecryptCookie` functions have been added to ensure robust validation and prevent potential runtime errors.
Applied to files:
middleware/encryptcookie/encryptcookie_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3056
File: middleware/encryptcookie/utils.go:51-54
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests for key length enforcement in `DecryptCookie` have been added to ensure consistency and security in the encryption processes.
Applied to files:
middleware/encryptcookie/encryptcookie_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3051
File: middleware/session/session.go:215-216
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Applied to files:
app_test.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
Applied to files:
middleware/basicauth/basicauth_test.go
📚 Learning: 2024-09-25T16:17:00.969Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:16-26
Timestamp: 2024-09-25T16:17:00.969Z
Learning: In the session middleware `Config` struct, `Store` is backed by `fiber.Storage`; they are different entities serving distinct purposes in session management.
Applied to files:
middleware/session/middleware.gomiddleware/csrf/csrf.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-09-25T16:15:39.392Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/session_manager.go:30-43
Timestamp: 2024-09-25T16:15:39.392Z
Learning: In the session middleware, `session.FromContext(c)` returns `*session.Middleware`, whereas `m.session.Get(c)` returns `*session.Store`, so they are not directly interchangeable.
Applied to files:
middleware/session/middleware.gomiddleware/csrf/csrf.gomiddleware/csrf/csrf_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/csrf_test.go:164-165
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the `Test_CSRF_WithSession_Middleware` function, calling `session.NewWithStore()` without arguments is acceptable, as the default configuration is sufficient.
Applied to files:
middleware/session/middleware.gomiddleware/csrf/csrf_test.go
📚 Learning: 2025-10-22T13:48:12.485Z
Learnt from: CR
Repo: gofiber/fiber PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-22T13:48:12.485Z
Learning: Run tests with gotestsum (Make target: test)
Applied to files:
middleware/skip/skip_test.go
🧬 Code graph analysis (51)
middleware/pprof/pprof_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/cache/cache_test.go (1)
constants.go (5)
MethodGet(5-5)MethodPost(7-7)HeaderCacheControl(168-168)MethodHead(6-6)HeaderAge(167-167)
middleware/logger/logger_test.go (2)
constants.go (3)
MethodGet(5-5)StatusOK(52-52)MethodPost(7-7)app.go (1)
TestConfig(1093-1104)
middleware/recover/recover_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/proxy/proxy_test.go (2)
constants.go (1)
MethodGet(5-5)app.go (1)
TestConfig(1093-1104)
middleware/logger/tags.go (2)
middleware/logger/config.go (2)
Buffer(108-119)Config(12-99)ctx_interface_gen.go (1)
Ctx(18-431)
res_interface_gen.go (2)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)
middleware/basicauth/basicauth.go (2)
middleware/csrf/csrf.go (2)
New(47-214)Handler(30-34)middleware/limiter/limiter.go (2)
New(23-29)Handler(18-20)
middleware/proxy/proxy.go (1)
middleware/proxy/config.go (1)
Config(12-70)
middleware/healthcheck/healthcheck_test.go (1)
constants.go (3)
MethodGet(5-5)MethodPost(7-7)StatusMethodNotAllowed(78-78)
middleware/envvar/envvar_test.go (1)
constants.go (3)
MethodGet(5-5)MethodPost(7-7)MethodHead(6-6)
redirect_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/logger/utils.go (1)
color.go (1)
Colors(8-53)
middleware/earlydata/earlydata_test.go (1)
constants.go (2)
MethodGet(5-5)MethodPost(7-7)
ctx_test.go (2)
constants.go (3)
MethodGet(5-5)StatusOK(52-52)HeaderContentDisposition(211-211)app.go (2)
Map(43-43)ErrTestGotEmptyResponse(1090-1090)
res.go (3)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)extractors/extractors.go (1)
ErrNotFound(64-64)
prefork.go (1)
listen.go (3)
App(287-324)App(342-360)ListenConfig(42-125)
adapter_test.go (2)
constants.go (1)
MethodGet(5-5)app.go (1)
TestConfig(1093-1104)
middleware/encryptcookie/encryptcookie_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/adaptor/adaptor_test.go (2)
constants.go (2)
MethodGet(5-5)MethodPost(7-7)app.go (1)
TestConfig(1093-1104)
prefork_test.go (2)
listen.go (1)
ListenConfig(42-125)constants.go (1)
NetworkTCP6(293-293)
middleware/requestid/requestid_test.go (1)
constants.go (3)
MethodGet(5-5)StatusOK(52-52)HeaderXRequestID(281-281)
hooks.go (1)
router.go (1)
Route(43-64)
middleware/expvar/expvar_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/limiter/limiter.go (1)
middleware/limiter/config.go (1)
Config(10-75)
middleware/logger/config.go (2)
middleware/cache/config.go (1)
Config(11-80)middleware/logger/data.go (1)
Data(9-18)
hooks_test.go (2)
listen.go (1)
ListenConfig(42-125)router.go (1)
Route(43-64)
middleware/timeout/timeout_test.go (1)
constants.go (1)
MethodGet(5-5)
app_test.go (1)
app.go (2)
TestConfig(1093-1104)Config(115-426)
bind_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/compress/compress_test.go (1)
constants.go (2)
MethodGet(5-5)MethodHead(6-6)
ctx_interface_gen.go (2)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)
middleware/keyauth/keyauth_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/basicauth/basicauth_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/helmet/helmet_test.go (1)
constants.go (2)
MethodGet(5-5)HeaderReferrerPolicy(229-229)
middleware/rewrite/rewrite_test.go (1)
constants.go (1)
MethodGet(5-5)
mount_test.go (1)
constants.go (3)
MethodGet(5-5)StatusOK(52-52)MethodPost(7-7)
services.go (1)
color.go (2)
Colors(8-53)DefaultColors(56-66)
middleware/redirect/redirect_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/session/middleware.go (1)
middleware/session/config.go (1)
Config(13-90)
redirect.go (2)
app.go (1)
App(68-112)router.go (1)
App(376-396)
listen.go (1)
hooks.go (1)
ListenData(46-50)
middleware/idempotency/idempotency_test.go (1)
middleware/idempotency/config.go (1)
ConfigDefault(58-81)
middleware/csrf/csrf.go (1)
middleware/csrf/config.go (1)
Config(16-126)
middleware/limiter/limiter_sliding.go (2)
middleware/limiter/limiter.go (2)
New(23-29)Handler(18-20)middleware/limiter/config.go (1)
Config(10-75)
middleware/etag/etag_test.go (1)
constants.go (2)
MethodGet(5-5)MethodPut(8-8)
middleware/limiter/limiter_fixed.go (2)
middleware/limiter/limiter.go (2)
New(23-29)Handler(18-20)middleware/limiter/config.go (1)
Config(10-75)
middleware/cors/cors.go (2)
middleware/cors/config.go (1)
Config(8-79)constants.go (1)
HeaderAccessControlMaxAge(203-203)
middleware/logger/default_logger.go (2)
middleware/logger/config.go (1)
Config(12-99)middleware/logger/format.go (1)
DefaultFormat(5-5)
middleware/skip/skip_test.go (1)
constants.go (1)
MethodGet(5-5)
middleware/csrf/csrf_test.go (2)
middleware/csrf/config.go (1)
Config(16-126)middleware/session/config.go (1)
Config(13-90)
⏰ 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). (5)
- GitHub Check: assign-v3
- GitHub Check: unit (1.25.x, windows-latest)
- GitHub Check: lint
- GitHub Check: Compare
- GitHub Check: repeated
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
res.go (1)
609-610: Route not found returns empty Route, not error.When
app.GetRoute(routeName)doesn't find a route, it returns a zero-valueRoute{}rather than an error. This means:
&routewill never be nil- The zero-value Route has empty
routeParser.segs, sogetLocationFromRoutereturns an empty string with no errorIf the intent is to return
ErrNotFoundwhen a route doesn't exist, consider checking if the route is valid (e.g.,route.Path == ""):route := r.c.app.GetRoute(routeName) if route.Path == "" { return "", ErrNotFound } return r.getLocationFromRoute(&route, params)However, this changes existing behavior, so only apply if that's the desired outcome.
🧹 Nitpick comments (4)
client/client_test.go (2)
53-55: Simplify the channel receive assignment.The intermediate variable
receivedis unnecessary. Direct assignment to the named return variable is clearer and more idiomatic.Apply this diff to simplify:
select { - case received := <-addrChan: - addr = received + case addr = <-addrChan: return app, addr
60-60: Remove unreachable return statement.This return statement is unreachable because
t.Fatalfon line 57 terminates the test. The line can be safely removed.Apply this diff:
case err := <-errChan: t.Fatalf("Failed to start test server: %v", err) } - - return nil, "" }ctx_test.go (1)
22-31: http.NoBody adoption in tests: LGTMThe replacements are correct and align with linter expectations.
For consistency and resource hygiene, consider adding
t.Cleanup(func(){ _ = resp.Body.Close() })afterapp.Test(...)in spots that read the body but don’t already close it.Also applies to: 167-174, 192-207, 257-265, 3690-3694
middleware/idempotency/idempotency_test.go (1)
225-240: Close response body in helper to avoid leaks
do()reads the body but never closes it. Safe to close before returning since callers only read headers/status.-func do(app *fiber.App, req *http.Request) (resp *http.Response, body string) { - var err error - resp, err = app.Test(req, fiber.TestConfig{Timeout: 5 * time.Second}) +func do(app *fiber.App, req *http.Request) (resp *http.Response, body string) { + var err error + resp, err = app.Test(req, fiber.TestConfig{Timeout: 5 * time.Second}) if err != nil { panic(err) } - var payload []byte - payload, err = io.ReadAll(resp.Body) + defer func() { _ = resp.Body.Close() }() + payload, err := io.ReadAll(resp.Body) if err != nil { panic(err) } - body = string(payload) - return resp, body + return resp, string(payload) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (25)
app.go(3 hunks)app_test.go(47 hunks)client/client_test.go(2 hunks)client/helper_test.go(1 hunks)ctx.go(1 hunks)ctx_interface_gen.go(2 hunks)ctx_test.go(52 hunks)extractors/extractors.go(1 hunks)helpers.go(5 hunks)internal/storage/memory/memory.go(3 hunks)internal/tlstest/tls.go(3 hunks)middleware/adaptor/adaptor_test.go(10 hunks)middleware/cache/heap.go(1 hunks)middleware/cors/utils.go(2 hunks)middleware/csrf/helpers.go(1 hunks)middleware/idempotency/idempotency_test.go(12 hunks)middleware/logger/tags.go(2 hunks)middleware/proxy/proxy_test.go(35 hunks)middleware/static/static.go(1 hunks)mount_test.go(18 hunks)path.go(1 hunks)req.go(7 hunks)req_interface_gen.go(1 hunks)res.go(5 hunks)router.go(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- middleware/logger/tags.go
- app_test.go
- middleware/proxy/proxy_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Apply formatting using gofumpt (Make target: format)
Optimize struct field alignment using betteralign (Make target: betteralign)
Modernize code using gopls modernize (Make target: modernize)
Files:
extractors/extractors.gointernal/storage/memory/memory.gomiddleware/csrf/helpers.gomiddleware/idempotency/idempotency_test.gorouter.goctx.gomiddleware/cors/utils.gomiddleware/cache/heap.goctx_interface_gen.gores.goclient/client_test.goctx_test.gomiddleware/adaptor/adaptor_test.gointernal/tlstest/tls.gohelpers.gopath.goapp.goreq.gomiddleware/static/static.goreq_interface_gen.goclient/helper_test.gomount_test.go
🧠 Learnings (13)
📓 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`.
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:19:52.418Z
Learning: In the Fiber codebase, the linter does not allow `require` assertions from within HTTP handlers (including net/http-style handlers). Use `t.Fatalf`, `t.Errorf`, or similar `testing.T` methods for error handling inside handler functions instead.
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:19:52.418Z
Learning: In the Fiber codebase, the linter does not allow `require` assertions from within HTTP handlers (including net/http-style handlers). Use `t.Fatalf`, `t.Errorf`, or similar `testing.T` methods for error handling inside handler functions instead.
Applied to files:
middleware/idempotency/idempotency_test.goclient/client_test.goctx_test.gomiddleware/adaptor/adaptor_test.goclient/helper_test.gomount_test.go
📚 Learning: 2024-11-29T12:37:27.581Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: app_test.go:893-895
Timestamp: 2024-11-29T12:37:27.581Z
Learning: In the `Test_App_ShutdownWithContext` function in `app_test.go`, the `clientDone` channel is used to synchronize the client's request completion before proceeding, eliminating the need for additional `time.Sleep` calls.
Applied to files:
middleware/idempotency/idempotency_test.goclient/client_test.goctx_test.gomount_test.go
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:15:26.529Z
Learning: In Fiber v3, net/http handlers (http.Handler, http.HandlerFunc, or raw func(http.ResponseWriter, *http.Request)) can be passed directly to routing methods like app.Get(), app.Post(), etc. The framework automatically detects and wraps them internally via toFiberHandler/collectHandlers. The github.com/gofiber/fiber/v3/middleware/adaptor package is legacy and should not be suggested for tests or code using native net/http handler support.
Applied to files:
middleware/idempotency/idempotency_test.gorouter.goctx_test.gomiddleware/adaptor/adaptor_test.goclient/helper_test.gomount_test.go
📚 Learning: 2024-09-25T17:09:03.756Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/middleware_test.go:400-407
Timestamp: 2024-09-25T17:09:03.756Z
Learning: In the `Test_Session_Next` function in `middleware/session/middleware_test.go`, the variable `doNext` is properly synchronized with the `muNext` mutex for both read and write access.
Applied to files:
middleware/idempotency/idempotency_test.go
📚 Learning: 2024-09-25T16:18:34.719Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:122-122
Timestamp: 2024-09-25T16:18:34.719Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.
Applied to files:
middleware/idempotency/idempotency_test.gomiddleware/adaptor/adaptor_test.gomiddleware/static/static.gomount_test.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:
client/client_test.gomiddleware/adaptor/adaptor_test.goclient/helper_test.gomount_test.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Applied to files:
ctx_test.gomiddleware/adaptor/adaptor_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:
ctx_test.gomount_test.go
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Applied to files:
ctx_test.gomiddleware/adaptor/adaptor_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:
ctx_test.gomount_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/csrf_test.go:188-193
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the Fiber framework tests, using `ctx.Response.Header.Cookie` may not be suitable for parsing cookies from the response header, as it requires a `*Cookie` and fills it rather than returning a string value; thus, manual parsing of the `Set-Cookie` header may be necessary.
Applied to files:
middleware/adaptor/adaptor_test.gomiddleware/static/static.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:
path.go
🧬 Code graph analysis (7)
middleware/idempotency/idempotency_test.go (2)
app.go (1)
TestConfig(1093-1104)middleware/idempotency/config.go (1)
ConfigDefault(58-81)
ctx_interface_gen.go (2)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)
res.go (3)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)extractors/extractors.go (1)
ErrNotFound(64-64)
ctx_test.go (2)
constants.go (1)
MethodGet(5-5)app.go (2)
Map(43-43)ErrTestGotEmptyResponse(1090-1090)
middleware/adaptor/adaptor_test.go (2)
constants.go (2)
MethodGet(5-5)MethodPost(7-7)app.go (1)
TestConfig(1093-1104)
req.go (1)
constants.go (1)
HeaderXForwardedHost(220-220)
client/helper_test.go (1)
listen.go (3)
App(287-324)App(342-360)ListenConfig(42-125)
⏰ 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). (6)
- GitHub Check: Compare
- GitHub Check: repeated
- GitHub Check: unit (1.25.x, windows-latest)
- GitHub Check: unit (1.25.x, macos-latest)
- GitHub Check: unit (1.25.x, macos-13)
- GitHub Check: lint
🔇 Additional comments (35)
middleware/static/static.go (1)
205-205: LGTM! Idiomatic empty string check.The change to use
!= ""instead oflen(cacheControlValue) > 0is more idiomatic in Go and improves readability while maintaining identical behavior.middleware/cors/utils.go (2)
21-21: LGTM! Idiomatic empty-string check.The change from
len(input) > 0toinput != ""is more idiomatic in Go and aligns with the modernization objectives of this PR.
34-34: LGTM! Named return values improve clarity.The addition of named return values
(valid bool, normalized string)makes the function signature self-documenting and improves code readability. The implementation correctly uses explicit returns throughout.middleware/cache/heap.go (3)
84-87: LGTM! Named return parameters improve documentation.The addition of named return parameters makes the function signature self-documenting, clarifying that the method returns the cache key and entry size.
90-92: LGTM! Consistent with the other removal methods.The named return parameters maintain consistency with
removeInternaland clearly document the method's return values.
95-97: LGTM! Completes the consistent signature pattern.The named return parameters are consistent with the other removal methods, making the API more uniform and self-documenting.
client/client_test.go (1)
29-32: LGTM! Correct use of named return values.The function signature now uses named return values, and the assignment on line 32 correctly uses
=instead of:=to avoid shadowing the named return parameterapp.client/helper_test.go (1)
73-88: LGTM! Named returns improve clarity.The refactor to named return values is correct and makes the function signature more self-documenting. The implementation properly assigns to the named returns (
app = fiber.New()instead ofapp :=), and the closures correctly capture the necessary variables. The explicit return statement maintains clarity even though naked return could be used.mount_test.go (1)
25-31: Use of http.NoBody in tests: LGTMSwitching nil bodies to
http.NoBodymatches gocritic httpNoBody guidance and keeps semantics.Also applies to: 47-51, 77-90, 100-137, 144-151
internal/storage/memory/memory.go (1)
52-55: Idiom improvement for empty key checks
key == ""is clearer thanlen(key) == 0. Behavior preserved.Also applies to: 80-83, 112-115
middleware/csrf/helpers.go (1)
21-48: Named return values: OKSwitching to named returns improves clarity without changing behavior. Origin validation/normalization logic remains sound.
middleware/idempotency/idempotency_test.go (1)
83-97: http.NoBody usage: LGTMThe move to
http.NoBodyacross requests is correct and aligns with gocritic httpNoBody.Also applies to: 254-264, 272-279, 287-294, 302-309, 328-343, 352-363, 372-378, 400-405, 415-420
path.go (1)
215-226: Loop condition change is approved; Go version compatibility confirmed
for pattern != ""is semantically correct and clear. The module's Go version (1.25.0) fully supports all modern constructs used in the codebase, including integer-range loops likefor i := range segLenat path.go:262. No compatibility issues will arise.req_interface_gen.go (1)
33-39: Verification complete: interface signature is compatible with implementationThe implementation in
req.go:84matches the interface signatures in bothreq_interface_gen.go:33andctx_interface_gen.go:187. Named return values don't affect Go's type identity, and the single implementation found compiles correctly with the interface signature. No breaking changes.ctx_interface_gen.go (2)
187-187: LGTM! Named return values improve clarity.The addition of named return values (
body []byte, decodesRealized uint8, err error) enhances readability without changing behavior.
376-376: LGTM! Pointer parameter reduces memory overhead.Changing the
routeparameter fromRouteto*Routeaddresses the gocritic hugeParam issue by avoiding a struct copy. The Route struct contains multiple fields and slices, making pointer passing more efficient.ctx.go (1)
408-408: LGTM! More idiomatic empty string check.The change from
len(token) == 0totoken == ""is a style improvement with no behavioral change. Both are functionally equivalent, but the latter is more idiomatic in Go.internal/tlstest/tls.go (1)
20-20: LGTM! Named return values improve clarity.The refactor to use named return values (
serverTLSConfandclientTLSConf) is implemented correctly:
- Signature declares the named returns
- Assignments changed from
:=to=to properly assign to the named variables- Behavior remains unchanged
This makes the function's return contract more explicit.
Also applies to: 119-119, 128-128
middleware/adaptor/adaptor_test.go (1)
225-225: LGTM! Correctly addresses gocritic httpNoBody check.Replacing
nilwithhttp.NoBodyfor requests without a body is the correct fix for the gocritic httpNoBody linter check.http.NoBodyis more explicit and semantically correct, indicating an intentionally empty body rather than an uninitialized value.All changes are in test code with no behavioral impact on test outcomes.
Also applies to: 253-253, 345-345, 354-354, 399-399, 423-423, 434-434, 675-675, 796-796
helpers.go (3)
168-168: LGTM! More idiomatic empty string checks.The changes from
len(value) == 0andlen(path) == 0tovalue == ""andpath == ""are style improvements with no behavioral changes. The latter form is more idiomatic in Go.Also applies to: 175-175
616-626: LGTM! Named return values improve clarity.The refactor to use named return values for
normalizeEtagis implemented correctly:
- Line 616: Signature declares named returns
(value string, weak bool, ok bool)- Line 617: Assignment to
weakuses=correctly- Return statements properly return the named values
This makes the function's contract more explicit.
689-722: LGTM! Named return values implemented correctly.The refactor to use named return values for
parseAddris correct:
- Line 689: Signature declares
(host string, port string)- Lines 699, 709: Assignments use
=to assign to named return variables- All return paths correctly return or assign the named variables
This improves code clarity without changing behavior.
res.go (3)
143-143: LGTM! More idiomatic empty string check.The change from
len(h) == 0toh == ""is a style improvement with no behavioral change.
574-577: Nil check is necessary but consider edge cases.The nil check prevents panics when
getLocationFromRouteis called with a nil pointer, which is good defensive programming. However, note thatGetRouteURL(line 609) callsapp.GetRoute(routeName)which returns a zero-valueRoute{}(not nil) when the route is not found, then passes&routeto this function.For that call path:
- A zero-value Route will have an empty
routeParser.segsslice- The loop at line 581 will iterate zero times (safe)
- The function will return an empty location string (line 601)
The nil check protects against direct calls with nil, which is appropriate for a public method.
797-799: LGTM! Idiomatic empty string checks.The changes to use
file == ""andcacheControlValue != ""instead of length checks are more idiomatic with no behavioral changes.Also applies to: 849-849
extractors/extractors.go (1)
130-130: LGTM! More idiomatic empty string check.The change from
len(rest) == 0torest == ""is a style improvement with no behavioral change. The latter is more idiomatic in Go.app.go (3)
629-629: LGTM! Pointer parameter avoids struct copy.Passing
&app.config.ColorSchemeas a pointer todefaultColorsaddresses the gocritic hugeParam issue by avoiding a copy of the ColorScheme struct. This aligns with the broader refactor to use pointer parameters for large structs.
650-650: LGTM! More idiomatic empty string check.The change from
len(s) == 0tos == ""is a style improvement with no behavioral change.
740-740: LGTM! Pointer parameter matches updated hook signature.Passing
app.latestRoute(which is*Route) toexecuteOnNameHooksis correct, as the hook signature was updated to accept*Routeinstead ofRouteas part of the hugeParam fixes.router.go (3)
96-96: LGTM: Idiomatic string empty check.The change from
len(detectionPath) > 0todetectionPath != ""is a more idiomatic Go pattern for checking non-empty strings while preserving the same logic.
520-520: LGTM: More idiomatic nil check.Changing from
nil == htoh == nilfollows Go conventions by avoiding Yoda-style conditionals.
616-616: Code changes verified—no issues found.The
executeOnRouteHookssignature has been correctly updated to accept*Route(line 140 in hooks.go). Both calls at lines 616 and 679 in router.go correctly pass route pointers directly without dereferencing, which aligns with the PR's goal of avoiding large struct copies.req.go (3)
87-87: LGTM: Named return values improve clarity.Adding named return values provides better documentation without changing behavior. All return statements remain explicit, which is good practice.
146-146: LGTM: Idiomatic string emptiness checks.The changes from
len(str) > 0/len(str) == 0to direct string comparison (str != ""/str == "") are idiomatic Go patterns that improve readability while preserving the same logic.Also applies to: 317-317, 353-353, 586-586
410-410: LGTM: Label removal is correct.Removing the
Locallabel fromcontinuestatements is appropriate since these are within the innermost loops. The plaincontinuestatements correctly skip to the next iteration.Also applies to: 462-462
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
middleware/cache/heap.go (1)
84-84: Minor: Inconsistent nolint comment wording.The nolint comment here says "when removing heap entries" while the similar comments on lines 90 and 95 say "when removing" or just describe the "returned key and size pair." Consider standardizing the wording for consistency.
-func (h *indexedHeap) removeInternal(realIdx int) (key string, size uint) { //nolint:nonamedreturns // gocritic unnamedResult prefers named key and size when removing heap entries +func (h *indexedHeap) removeInternal(realIdx int) (key string, size uint) { //nolint:nonamedreturns // gocritic unnamedResult prefers naming returned key and size pairclient/client_test.go (1)
52-60: Remove unreachable return statement.Lines 59-60 contain an unreachable
return nil, ""statement since both branches of the select (line 54 and line 56) exit the function. This dead code should be removed for clarity.Apply this diff to remove the unreachable code:
select { case addr = <-addrChan: return app, addr case err := <-errChan: t.Fatalf("Failed to start test server: %v", err) } - - return nil, "" }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
client/client_test.go(2 hunks)client/helper_test.go(1 hunks)ctx_interface_gen.go(2 hunks)helpers.go(5 hunks)internal/tlstest/tls.go(3 hunks)middleware/cache/heap.go(1 hunks)middleware/cors/utils.go(2 hunks)middleware/csrf/helpers.go(1 hunks)middleware/idempotency/idempotency_test.go(12 hunks)middleware/proxy/proxy_test.go(35 hunks)req.go(8 hunks)req_interface_gen.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- middleware/cors/utils.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Apply formatting using gofumpt (Make target: format)
Optimize struct field alignment using betteralign (Make target: betteralign)
Modernize code using gopls modernize (Make target: modernize)
Files:
middleware/cache/heap.goctx_interface_gen.goreq_interface_gen.gointernal/tlstest/tls.goreq.gohelpers.goclient/client_test.gomiddleware/csrf/helpers.goclient/helper_test.gomiddleware/proxy/proxy_test.gomiddleware/idempotency/idempotency_test.go
🧠 Learnings (10)
📓 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`.
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 2864
File: ctx_test.go:4816-4816
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 2864
File: ctx_test.go:4816-4816
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
📚 Learning: 2025-10-22T13:48:12.485Z
Learnt from: CR
Repo: gofiber/fiber PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-22T13:48:12.485Z
Learning: Applies to **/*.go : Modernize code using gopls modernize (Make target: modernize)
Applied to files:
helpers.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:
client/client_test.goclient/helper_test.gomiddleware/proxy/proxy_test.go
📚 Learning: 2024-11-29T12:37:27.581Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: app_test.go:893-895
Timestamp: 2024-11-29T12:37:27.581Z
Learning: In the `Test_App_ShutdownWithContext` function in `app_test.go`, the `clientDone` channel is used to synchronize the client's request completion before proceeding, eliminating the need for additional `time.Sleep` calls.
Applied to files:
client/client_test.gomiddleware/proxy/proxy_test.gomiddleware/idempotency/idempotency_test.go
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:19:52.418Z
Learning: In the Fiber codebase, the linter does not allow `require` assertions from within HTTP handlers (including net/http-style handlers). Use `t.Fatalf`, `t.Errorf`, or similar `testing.T` methods for error handling inside handler functions instead.
Applied to files:
client/client_test.goclient/helper_test.gomiddleware/proxy/proxy_test.gomiddleware/idempotency/idempotency_test.go
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:15:26.529Z
Learning: In Fiber v3, net/http handlers (http.Handler, http.HandlerFunc, or raw func(http.ResponseWriter, *http.Request)) can be passed directly to routing methods like app.Get(), app.Post(), etc. The framework automatically detects and wraps them internally via toFiberHandler/collectHandlers. The github.com/gofiber/fiber/v3/middleware/adaptor package is legacy and should not be suggested for tests or code using native net/http handler support.
Applied to files:
client/helper_test.gomiddleware/proxy/proxy_test.gomiddleware/idempotency/idempotency_test.go
📚 Learning: 2024-09-25T16:18:34.719Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:122-122
Timestamp: 2024-09-25T16:18:34.719Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.
Applied to files:
middleware/proxy/proxy_test.gomiddleware/idempotency/idempotency_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/csrf_test.go:188-193
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the Fiber framework tests, using `ctx.Response.Header.Cookie` may not be suitable for parsing cookies from the response header, as it requires a `*Cookie` and fills it rather than returning a string value; thus, manual parsing of the `Set-Cookie` header may be necessary.
Applied to files:
middleware/proxy/proxy_test.go
📚 Learning: 2024-09-25T17:05:06.991Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/middleware_test.go:190-191
Timestamp: 2024-09-25T17:05:06.991Z
Learning: When testing session `IdleTimeout` expiration, it's acceptable to use `time.Sleep` to simulate the passage of time in tests.
Applied to files:
middleware/proxy/proxy_test.go
📚 Learning: 2024-09-25T17:09:03.756Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/middleware_test.go:400-407
Timestamp: 2024-09-25T17:09:03.756Z
Learning: In the `Test_Session_Next` function in `middleware/session/middleware_test.go`, the variable `doNext` is properly synchronized with the `muNext` mutex for both read and write access.
Applied to files:
middleware/idempotency/idempotency_test.go
🧬 Code graph analysis (5)
ctx_interface_gen.go (2)
router.go (1)
Route(43-64)app.go (1)
Map(43-43)
req.go (1)
constants.go (6)
StrGzip(299-299)StrBr(302-302)StrBrotli(304-304)StrDeflate(303-303)StrZstd(305-305)HeaderXForwardedHost(220-220)
client/client_test.go (1)
listen.go (3)
App(287-324)App(342-360)ListenConfig(42-125)
middleware/proxy/proxy_test.go (2)
app.go (1)
TestConfig(1093-1104)constants.go (2)
NetworkTCP4(292-292)MethodGet(5-5)
middleware/idempotency/idempotency_test.go (1)
app.go (1)
TestConfig(1093-1104)
⏰ 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). (6)
- GitHub Check: lint
- GitHub Check: repeated
- GitHub Check: unit (1.25.x, macos-latest)
- GitHub Check: unit (1.25.x, macos-13)
- GitHub Check: unit (1.25.x, windows-latest)
- GitHub Check: Compare
🔇 Additional comments (15)
middleware/idempotency/idempotency_test.go (2)
84-84: LGTM: http.NoBody migration is correct.Replacing
nilwithhttp.NoBodyacross all test request creation is the proper way to represent an empty request body and aligns with the gocritic httpNoBody linting check. Since none of these tests require actual request bodies, the change is semantically equivalent while being more explicit.Also applies to: 250-250, 254-254, 268-268, 283-283, 298-298, 324-324, 331-331, 348-348, 368-368, 382-382, 396-396, 411-411
226-236: Helper function changes maintain clarity.The addition of named returns and the variable rename from
bodytopayloadavoids shadowing the return parameter while keeping the function's behavior unchanged. The nolint comment appropriately explains the design choice.middleware/cache/heap.go (1)
84-96: LGTM: Named returns added to satisfy gocritic.The addition of named return values to these three methods addresses gocritic's unnamedResult check as described in the PR objectives. The approach is consistent across all three methods, and the nolint directives appropriately document the conflict with the nonamedreturns check. Since the function bodies still use explicit returns rather than relying on implicit named returns, the behavior remains unchanged.
client/client_test.go (2)
29-36: LGTM! Named returns properly implemented for gocritic compliance.The function signature correctly uses named returns with an appropriate nolint comment explaining the requirement. The initialization of
appvia assignment (rather than declaration) is the correct approach when using named return values.
40-50: Good practice: explicit parameter instead of closure capture.While not strictly required for the named returns refactor, passing
appas an explicit parameter to the goroutine (rather than capturing it from the closure) makes the data flow more explicit and is generally better practice for concurrent code.client/helper_test.go (1)
73-88: LGTM! Clean refactor to named returns.The function has been cleanly refactored to use named returns for gocritic compliance. The explicit variable definitions for
dialandstartwith their function types make the code very readable, and the explicit return statement is good practice even with named returns.internal/tlstest/tls.go (3)
20-20: LGTM: Named returns improve clarity for TLS config pair.The named return parameters clearly distinguish the server and client TLS configurations, which is valuable given the function returns two configs of the same type. The nolint directive appropriately allows this to satisfy gocritic's unnamedResult preference while suppressing conflicting linters.
119-122: LGTM: Correct assignment syntax for named return.The change from
:=to=is required becauseserverTLSConfis now a named return parameter. The assignment correctly sets the server TLS configuration that will be returned.
128-131: LGTM: Correct assignment syntax for named return.The change from
:=to=is required becauseclientTLSConfis now a named return parameter. The assignment correctly sets the client TLS configuration that will be returned.middleware/proxy/proxy_test.go (5)
7-7: LGTM! Import added for http.NoBody.The
net/httpimport is required for thehttp.NoBodyconstant used throughout the test file.
33-47: LGTM! Named returns implemented correctly.The helper function now uses named returns with appropriate nolint documentation. The implementation correctly assigns to the named return variables and maintains existing behavior.
49-52: LGTM! Wrapper function with named returns.The IPv4 wrapper correctly delegates to
createProxyTestServerwith the appropriate network constant.
54-57: LGTM! Wrapper function with named returns.The IPv6 wrapper correctly delegates to
createProxyTestServerwith the appropriate network constant.
126-938: LGTM! Systematic replacement of nil with http.NoBody.All test request constructions now correctly use
http.NoBodyinstead ofnilfor empty request bodies. This addresses the gocritic httpNoBody check and aligns with Go best practices for test requests. The changes are consistent across all 33+ test cases and maintain existing behavior.req.go (1)
84-127: Named returns keep decode accounting clear.The switch to named results and the per-iteration
decodeErrmakes the decoding loop easier to follow without altering the existing fallbacks. Nice cleanup.
|
Finally, lint is successful |
|
@ReneWerner87 Can we update this branch to see if release-drafter kicks? It should had tagged this PR as |
|
Sure |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/middleware/limiter.md(2 hunks)docs/middleware/logger.md(3 hunks)docs/middleware/proxy.md(2 hunks)docs/whats_new.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Review and update the contents of the
docsfolder if necessary when modifying code
Files:
docs/middleware/proxy.mddocs/whats_new.mddocs/middleware/limiter.mddocs/middleware/logger.md
🧠 Learnings (5)
📓 Common learnings
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 2864
File: ctx_test.go:4816-4816
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 2864
File: ctx_test.go:4816-4816
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The `ParamsInt` function's behavior, including handling empty string parameters, will be addressed in future PRs as per ReneWerner87's guidance.
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:15:26.529Z
Learning: In Fiber v3, net/http handlers (http.Handler, http.HandlerFunc, or raw func(http.ResponseWriter, *http.Request)) can be passed directly to routing methods like app.Get(), app.Post(), etc. The framework automatically detects and wraps them internally via toFiberHandler/collectHandlers. The github.com/gofiber/fiber/v3/middleware/adaptor package is legacy and should not be suggested for tests or code using native net/http handler support.
Applied to files:
docs/middleware/proxy.mddocs/whats_new.mddocs/middleware/limiter.md
📚 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:
docs/whats_new.md
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/csrf/csrf_test.go:164-165
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the `Test_CSRF_WithSession_Middleware` function, calling `session.NewWithStore()` without arguments is acceptable, as the default configuration is sufficient.
Applied to files:
docs/whats_new.md
📚 Learning: 2024-09-25T16:17:00.969Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:16-26
Timestamp: 2024-09-25T16:17:00.969Z
Learning: In the session middleware `Config` struct, `Store` is backed by `fiber.Storage`; they are different entities serving distinct purposes in session management.
Applied to files:
docs/middleware/limiter.md
🪛 LanguageTool
docs/middleware/logger.md
[style] ~175-~175: In American English, abbreviations like “etc.” require a period.
Context: ...ogging libraries (Zerolog, Zap, Logrus, etc). Defaults to Fiber's default logger if...
(ETC_PERIOD)
⏰ 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). (6)
- GitHub Check: Compare
- GitHub Check: unit (1.25.x, macos-latest)
- GitHub Check: unit (1.25.x, windows-latest)
- GitHub Check: repeated
- GitHub Check: lint
- GitHub Check: update_release_draft
🔇 Additional comments (6)
docs/middleware/proxy.md (1)
13-13: Documentation properly reflects Balancer variadic signature change.The signature update to variadic config is clearly documented and all examples show appropriate usage patterns.
docs/middleware/logger.md (1)
103-117: Documentation correctly reflects LoggerFunc pointer-to-Config signature change.The config parameter is now properly documented as a pointer type, and examples for predefined formats are clear and consistent.
docs/middleware/limiter.md (1)
23-26: Handler interface properly documented with pointer-to-Config signature.The new interface signature is clearly presented and the LimiterMiddleware field explanation properly communicates the pointer-based config pattern.
docs/whats_new.md (3)
1285-1286: LoggerFunc signature change properly documented with migration guidance.The documentation clearly explains the shift to pointer-based config in custom logger implementations and provides clear examples of the updated signature.
1448-1449: Limiter Handler interface change well-explained for custom implementations.The documentation accurately conveys that custom algorithms must now implement the updated interface with pointer-to-Config parameter, supporting migration from v2 to v3.
1466-1467: Proxy.Balancer variadic config change consistently documented.Both the feature overview (lines 1466-1467) and migration guide (line 2487) properly document the move to optional variadic configuration, providing clear guidance for users upgrading from v2.
Also applies to: 2487-2487
Summary
http.NoBodyso the gocritichttpNoBodycheck passesTesting
Codex Task