-
Notifications
You must be signed in to change notification settings - Fork 153
chore: Create Fiber v3 modules #1430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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. WalkthroughMass migration of contrib packages to Fiber v3: import paths moved to v3 subdirectories, many packages renamed, numerous public API signatures changed (notably *fiber.Ctx → fiber.Ctx and some callbacks now return error), README/docs and tests updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Middleware
participant Callback
participant Handler
Client->>Middleware: HTTP Request
note right of Middleware: v2 pattern (before)
Middleware->>Callback: callback(*fiber.Ctx) -- pointer receiver
Callback-->>Middleware: (maybe void)
Middleware->>Handler: chain.Next()
Handler-->>Client: Response
rect rgb(220,235,255)
note over Middleware,Callback: v3 pattern (after)
Middleware->>Callback: callback(fiber.Ctx) -- value receiver (some now return error)
Callback-->>Middleware: error? / nil
Middleware->>Handler: chain.Next()
Handler-->>Client: Response
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 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 a significant chore: updating module paths across several 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
|
There was a problem hiding this 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 correctly bumps the module paths for several modules to align with the v3 release. The changes include updating go.mod
files, import paths in Go files and READMEs, and adapting code examples and function signatures to be compatible with Fiber v3.
The updates to handle multi-value headers in fiberzap
and fiberzerolog
are a great improvement. The test enhancements across various modules, such as checking for errors from app.Test
and fixing Content-Type
assertions, improve the robustness of the test suite.
I've found one critical issue in opafiber/fiber.go
where a non-existent method is called, which will cause a compilation failure. I've provided a suggestion to fix this.
Overall, this is a well-executed and necessary update for the v3 release.
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (9)
fiberzerolog/README.md (2)
17-17
: Clarify Fiber version compatibility and support strategy.The compatibility note states "Compatible with Fiber v3" but doesn't clarify whether the v2 module works exclusively with Fiber v3 or also maintains backward compatibility with Fiber v2. Documentation should explicitly state which Fiber versions are supported by this module version to guide users during migration.
Consider updating the note to clarify the supported range:
-**Compatible with Fiber v3.** +**Requires Fiber v3.** (For Fiber v2, use the v1 module.)Or, if v2 supports both Fiber v2 and v3:
-**Compatible with Fiber v3.** +**Compatible with Fiber v3 and later.** (For Fiber v2 only, install the v1 module.)
44-44
: Minor grammar and capitalization refinements.The description for the
GetResBody
field has style inconsistencies: "When use compress" (should be "When using" or "When the compress middleware is used"), and lowercase "you" following a period (should be capitalized). While not blocking, these could be improved for readability.-Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. +Define a function to get response body when returning non-nil.<br />For example: when the compress middleware is used, resBody is unreadable. You can set GetResBody to retrieve the readable response body.fgprof/fgprof_test.go (1)
77-80
: Consider: Skip logic may be unnecessary for the 404 case.The request to
/prefix/debug/fgprof
doesn't match the configured prefix/test
, so it returns 404 without invoking the streaming fgprof handler. The streaming-endpoint skip logic seems unnecessary here, though it doesn't cause any harm.fibernewrelic/fiber_test.go (1)
388-394
: Redundant nil-check after assertion.Line 389 asserts that
tx
is not nil, which will fail the test iftx
is nil. The subsequent nil-check on line 391 is therefore redundant—iftx
were nil, the test would have already failed before reaching that line.Consider removing either the assertion or the nil-check for clarity:
Option 1: Keep assertion, remove nil-check (if tx should never be nil):
tx := FromContext(ctx) assert.NotNil(t, tx) -if tx != nil { - segment := tx.StartSegment("foo") - defer segment.End() -} +segment := tx.StartSegment("foo") +defer segment.End()Option 2: Remove assertion, keep nil-check (if tx might be nil in some scenarios):
tx := FromContext(ctx) -assert.NotNil(t, tx) if tx != nil { segment := tx.StartSegment("foo") defer segment.End() }
otelfiber/fiber.go (2)
112-117
: Header copy approach LGTM; minor perf note.Iterating c.GetReqHeaders() into http.Header is correct and clearer than VisitAll. Be aware it allocates a map; if this is a hot path, consider reusing a header buffer via pool later. Not a blocker.
99-105
: Restore the original user context; keep savedCtx only for metrics/cancel.You derive savedCtx from c (now a context) and later set it back. That restores a canceled context onto c, which is harmless but can surprise downstream code if reused. Capture the previous context and restore it; still use savedCtx for metrics and cancellation.
Apply this diff:
c.Locals(tracerKey, tracer) - savedCtx, cancel := context.WithCancel(c) + prevCtx := c.Context() + savedCtx, cancel := context.WithCancel(prevCtx) @@ - c.SetContext(savedCtx) + // Restore original user context; savedCtx is only for metrics/cancel. + c.SetContext(prevCtx) cancel()Please run unit tests focusing on middleware that inspects ctx after handlers return to confirm no observable change in behavior.
Also applies to: 166-168
otelfiber/example/server.go (1)
47-51
: Nit: JSON map uses a variable as a key, likely unintended.fiber.Map{"id": id, name: name} uses the variable name as the key. Prefer "name": name to produce {"id":"123","name":"..."}.
Apply:
- return c.JSON(fiber.Map{"id": id, name: name}) + return c.JSON(fiber.Map{"id": id, "name": name})otelfiber/otelfiber_test/fiber_test.go (1)
10-13
: Good test hardening: check err/resp and add timeouts.Nice consistency upgrades: capturing resp/err, require checks, and explicit timeouts reduce flakes. Constant matches instrumentationName v3. Consider a small helper to DRY the repeated app.Test + require boilerplate.
Optionally add coverage for scheme detection behind proxies:
func TestURLScheme_ForwardedProto(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) app := fiber.New() app.Use(otelfiber.Middleware(otelfiber.WithTracerProvider(tp))) app.Get("/s", func(c fiber.Ctx) error { return c.SendStatus(http.StatusOK) }) r := httptest.NewRequest(http.MethodGet, "/s", nil) r.Header.Set("X-Forwarded-Proto", "https") resp, err := app.Test(r, fiber.TestConfig{Timeout: 3 * time.Second}) require.NoError(t, err); require.NotNil(t, resp) spans := sr.Ended() require.Len(t, spans, 1) assert.Contains(t, spans[0].Attributes(), semconv.URLScheme("https")) }Also applies to: 32-33, 45-48, 64-67, 86-89, 109-112, 144-147, 174-177, 190-193, 217-220, 248-251, 314-317, 319-320, 445-448, 491-494, 533-536, 565-568, 596-599, 634-637
otelfiber/README.md (1)
92-92
: Minor inconsistency in example handler parameter naming.The example code uses inconsistent parameter naming: line 92 uses
ctx
, while line 96 usesc
. For consistency and clarity in documentation examples, consider standardizing on one naming convention (Fiber examples typically usec
for brevity, orctx
for clarity).- app.Get("/error", func(ctx fiber.Ctx) error { + app.Get("/error", func(c fiber.Ctx) error { return errors.New("abc") }) - app.Get("/users/:id", func(c fiber.Ctx) error { + app.Get("/users/:id", func(ctx fiber.Ctx) error { id := c.Params("id") name := getUser(c.UserContext(), id) return c.JSON(fiber.Map{"id": id, "name": name}) })Also applies to: 96-96
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (28)
.github/ISSUE_TEMPLATE/bug-report.yaml
is excluded by!**/*.yaml
.github/ISSUE_TEMPLATE/feature-request.yaml
is excluded by!**/*.yaml
.github/ISSUE_TEMPLATE/question.yaml
is excluded by!**/*.yaml
casbin/go.mod
is excluded by!**/*.mod
fgprof/go.mod
is excluded by!**/*.mod
fgprof/go.sum
is excluded by!**/*.sum
,!**/*.sum
fiberi18n/go.mod
is excluded by!**/*.mod
fibernewrelic/go.mod
is excluded by!**/*.mod
fibernewrelic/go.sum
is excluded by!**/*.sum
,!**/*.sum
fibersentry/go.mod
is excluded by!**/*.mod
fiberzap/go.mod
is excluded by!**/*.mod
fiberzerolog/go.mod
is excluded by!**/*.mod
jwt/go.mod
is excluded by!**/*.mod
monitor/go.mod
is excluded by!**/*.mod
monitor/go.sum
is excluded by!**/*.sum
,!**/*.sum
opafiber/go.mod
is excluded by!**/*.mod
opafiber/go.sum
is excluded by!**/*.sum
,!**/*.sum
otelfiber/example/go.mod
is excluded by!**/*.mod
otelfiber/example/go.sum
is excluded by!**/*.sum
,!**/*.sum
otelfiber/go.mod
is excluded by!**/*.mod
otelfiber/go.sum
is excluded by!**/*.sum
,!**/*.sum
paseto/go.mod
is excluded by!**/*.mod
socketio/go.mod
is excluded by!**/*.mod
socketio/go.sum
is excluded by!**/*.sum
,!**/*.sum
swagger/go.mod
is excluded by!**/*.mod
testcontainers/go.mod
is excluded by!**/*.mod
testcontainers/go.sum
is excluded by!**/*.sum
,!**/*.sum
websocket/go.mod
is excluded by!**/*.mod
📒 Files selected for processing (42)
casbin/README.md
(8 hunks)circuitbreaker/README.md
(9 hunks)circuitbreaker/circuitbreaker_test.go
(1 hunks)fgprof/README.md
(2 hunks)fgprof/fgprof_test.go
(3 hunks)fiberi18n/README.md
(1 hunks)fiberi18n/example/main.go
(1 hunks)fibernewrelic/README.md
(4 hunks)fibernewrelic/fiber.go
(1 hunks)fibernewrelic/fiber_test.go
(1 hunks)fibersentry/README.md
(2 hunks)fiberzap/README.md
(6 hunks)fiberzap/logger_test.go
(1 hunks)fiberzap/zap.go
(1 hunks)fiberzap/zap_test.go
(2 hunks)fiberzerolog/README.md
(4 hunks)fiberzerolog/config.go
(1 hunks)fiberzerolog/zerolog_test.go
(1 hunks)hcaptcha/README.md
(2 hunks)jwt/README.md
(7 hunks)jwt/jwt_test.go
(1 hunks)loadshed/README.md
(6 hunks)loadshed/loadshed_test.go
(1 hunks)monitor/README.md
(3 hunks)monitor/monitor.go
(1 hunks)monitor/monitor_test.go
(3 hunks)opafiber/README.md
(3 hunks)opafiber/fiber.go
(1 hunks)otelfiber/README.md
(3 hunks)otelfiber/doc.go
(1 hunks)otelfiber/example/server.go
(1 hunks)otelfiber/fiber.go
(5 hunks)otelfiber/otelfiber_test/fiber_test.go
(18 hunks)otelfiber/semconv.go
(3 hunks)paseto/README.md
(10 hunks)socketio/README.md
(4 hunks)socketio/socketio.go
(1 hunks)socketio/socketio_test.go
(1 hunks)swagger/README.md
(2 hunks)testcontainers/README.md
(1 hunks)websocket/README.md
(3 hunks)websocket/websocket_test.go
(0 hunks)
💤 Files with no reviewable changes (1)
- websocket/websocket_test.go
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: grivera64
PR: gofiber/fiber#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.
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
PR: gofiber/fiber#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:
loadshed/loadshed_test.go
fgprof/fgprof_test.go
otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
PR: gofiber/fiber#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:
fibernewrelic/fiber.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
PR: gofiber/fiber#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:
fibernewrelic/fiber.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#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:
fgprof/fgprof_test.go
otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
PR: gofiber/fiber#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:
fiberi18n/example/main.go
fiberzap/README.md
otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-10-16T10:04:06.328Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-10-16T10:04:06.328Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Applied to files:
fiberi18n/example/main.go
fiberi18n/README.md
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
fgprof/README.md
otelfiber/README.md
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
PR: gofiber/fiber#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:
fgprof/README.md
otelfiber/doc.go
paseto/README.md
📚 Learning: 2024-10-02T23:03:31.727Z
Learnt from: sixcolors
PR: gofiber/fiber#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:
otelfiber/otelfiber_test/fiber_test.go
🪛 LanguageTool
swagger/README.md
[grammar] ~38-~38: There might be a mistake here.
Context: ...ber/contrib/swagger/v2 ### Examples Import the middleware package
go impo...
(QB_NEW_EN)
fgprof/README.md
[grammar] ~30-~30: There might be a mistake here.
Context: ... | nil
| | Prefix | string
. | ...
(QB_NEW_EN)
fiberi18n/README.md
[grammar] ~36-~36: There might be a mistake here.
Context: ... | | RootPath | string
...
(QB_NEW_EN)
fiberzap/README.md
[grammar] ~36-~36: There might be a mistake here.
Context: ... | | Fields | []string
...
(QB_NEW_EN)
[grammar] ~37-~37: Ensure spelling is correct
Context: ...[]string
| Add fields what you want see. ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~40-~40: There might be a mistake here.
Context: ...zapcore.WarnLevel, zapcore.InfoLevel}| | SkipURIs |
[]string` ...
(QB_NEW_EN)
[grammar] ~42-~42: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. | nil
...
(QB_NEW_EN)
paseto/README.md
[grammar] ~191-~191: There might be a mistake here.
Context: ...t a restricted resource using the token in Authorization request header._ ```sh c...
(QB_NEW_EN)
[grammar] ~461-~461: There might be a mistake here.
Context: ...t a restricted resource using the token in Authorization request header._ ```sh c...
(QB_NEW_EN)
casbin/README.md
[grammar] ~37-~37: There might be a mistake here.
Context: ... | | Enforcer | *casbin.Enforcer
...
(QB_NEW_EN)
[grammar] ~38-~38: There might be a mistake here.
Context: ...r using ModelFilePath & PolicyAdapter| | Lookup |
func(fiber.Ctx) strin...
(QB_NEW_EN)
[grammar] ~43-~43: There might be a mistake here.
Context: ... | ### Examples - [Gorm Adapter](https://github.com/svcg/-f...
(QB_NEW_EN)
[grammar] ~44-~44: There might be a mistake here.
Context: ... | ### Examples - Gorm Adapter - [File Adapter](https://github.com/gofiber...
(QB_NEW_EN)
otelfiber/README.md
[grammar] ~37-~37: There might be a mistake here.
Context: ... | | WithTracerProvider
| `otelt...
(QB_NEW_EN)
[grammar] ~38-~38: There might be a mistake here.
Context: ...used | | WithMeterProvider
| `otelm...
(QB_NEW_EN)
[grammar] ~41-~41: There might be a mistake here.
Context: ...he HTTP requests. | If none are specified, global ones will be used | | (❌ Removed) WithServerName
...
(QB_NEW_EN)
[grammar] ~43-~43: There might be a mistake here.
Context: ...lt formatter returns the route pathRaw | | WithCustomAttributes
| `func(...
(QB_NEW_EN)
[grammar] ~45-~45: There might be a mistake here.
Context: ...ributes to the metrics. | nil | | WithCollectClientIP
| bool
...
(QB_NEW_EN)
fiberzerolog/README.md
[grammar] ~42-~42: There might be a mistake here.
Context: ...zerolog.WarnLevel, zerolog.InfoLevel}| | SkipURIs |
[]string` ...
(QB_NEW_EN)
[grammar] ~43-~43: There might be a mistake here.
Context: ... | | GetResBody | `func(c fiber.Ctx) []b...
(QB_NEW_EN)
[grammar] ~44-~44: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. ...
(QB_NEW_EN)
loadshed/README.md
[grammar] ~117-~117: There might be a mistake here.
Context: ...ned true. | nil
| | Criteria | LoadCriteria
...
(QB_NEW_EN)
[grammar] ~118-~118: There might be a mistake here.
Context: ...ia. | &CPULoadCriteria{...}
| | OnShed | func(c fiber.Ctx) error
|...
(QB_NEW_EN)
🪛 markdownlint-cli2 (0.18.1)
circuitbreaker/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
casbin/README.md
15-15: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
22-22: Link text should be descriptive
(MD059, descriptive-link-text)
⏰ 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). (14)
- GitHub Check: lint (websocket)
- GitHub Check: lint (jwt)
- GitHub Check: lint (fibernewrelic)
- GitHub Check: lint (circuitbreaker)
- GitHub Check: lint (loadshed)
- GitHub Check: lint (socketio)
- GitHub Check: lint (fiberi18n)
- GitHub Check: lint (swagger)
- GitHub Check: lint (fiberzerolog)
- GitHub Check: lint (paseto)
- GitHub Check: lint (testcontainers)
- GitHub Check: lint (hcaptcha)
- GitHub Check: lint (opafiber)
- GitHub Check: Tests (1.25.x)
🔇 Additional comments (81)
hcaptcha/README.md (2)
19-32
: Fiber v3 compatibility update is correct and complete.The module path (line 32) correctly omits the
/v1
suffix per the PR objectives, and the handler signatures throughout the documentation usefiber.Ctx
(value type) as required for Fiber v3. The install instructions and v3-only support statement are clear and accurate.
46-46
: Handler signatures correctly reflect Fiber v3 API.The
ResponseKeyFunc
callback (line 46) and example handlers (lines 72, 78) all use the correctfiber.Ctx
value-type signature, not pointer-style*fiber.Ctx
, which is the required pattern for Fiber v3 as documented in the framework.Also applies to: 72-72, 78-78
paseto/README.md (6)
21-27
: Install section correctly updated for Fiber v3 and contrib v2.The compatibility note and import paths are clear. Fiber v3 is paired with
contrib/paseto/v2
, which aligns with the PR's module path updates.
40-47
: Config table properly reflects API changes.The removal of
TokenPrefix
and introduction ofExtractor
is clearly documented. DefaultFromAuthHeader("Bearer")
provides a sensible and secure default.
49-70
: Extractors documentation is comprehensive and well-structured.References to
github.com/gofiber/fiber/v3/extractors
are correct, and the security considerations section effectively communicates token storage risks and best practices.
82-98
: Migration guide clearly explains the TokenPrefix → Extractor transition.The side-by-side comparison of old and new patterns will help developers transition existing code smoothly.
107-172
: Code examples consistently use Fiber v3 APIs and updated import paths.All examples correctly import from
github.com/gofiber/fiber/v3
, use thev2
contrib package, reference the extractors package, and define handlers withfiber.Ctx
(value type, not pointer). Handler signatures and configuration patterns are consistent across examples.Also applies to: 206-289, 294-320, 324-351, 356-432
191-191
: Static analysis grammar warnings are false positives.LanguageTool flagged transitions between descriptive text and code blocks as potential errors, but the markdown formatting is valid. No action needed.
Also applies to: 461-461
fiberzerolog/README.md (1)
21-21
: Signatures and module paths correctly updated for Fiber v3.All handler and callback function signatures have been properly migrated from pointer-style (
*fiber.Ctx
) to value-style (fiber.Ctx
), consistent with Fiber v3's interface-based context design. Module import paths are uniformly updated tofiberzerolog/v2
across documentation and example code.Also applies to: 35-35, 37-37, 44-44, 53-53, 65-65
fgprof/README.md (1)
17-52
: Fiber v3 compatibility migration looks correct.The README updates align well with the broader PR objective:
- Compatibility notice on line 17 is clear.
- Install instructions (lines 21–23) correctly direct users to fgprof/v2 and fiber/v3 packages.
- Handler signature on line 48 reflects Fiber v3's value-type
fiber.Ctx
(instead of pointer), which is consistent with v3 API changes.- Import paths on lines 41–42 are updated appropriately.
The changes are consistent and support the PR's migration toward Fiber v3 compatibility across the contrib ecosystem.
fibersentry/README.md (3)
17-23
: Installation path and compatibility messaging are clear and correct.The update to
fibersentry/v2
import path and the "Compatible with Fiber v3" note properly reflect the module versioning scheme for v3 support. Installation instructions are accurate and match the documented import patterns.
47-107
: Handler signatures and imports correctly reflect Fiber v3 value-style API.The usage example consistently uses:
- Value-type handler signatures:
func(c fiber.Ctx) error
(lines 84, 91, 95)- Updated imports:
fibersentry/v2
andfiber/v3
(lines 55–56)- Correct type assertions:
.(fiber.Ctx)
instead of*fiber.Ctx
(lines 65, 116)All align with Fiber v3's interface-based design for
fiber.Ctx
.
109-123
: BeforeSend callback example correctly updated for v3.The type assertion pattern
hint.Context.Value(sentry.RequestContextKey).(fiber.Ctx)
is appropriate for Fiber v3's interface-basedfiber.Ctx
. The callback example demonstrates proper context access in the new API style.To confirm correctness, please verify:
- That the Sentry integration in the
fibersentry
package actually storesfiber.Ctx
(or a concrete type implementing it) in the sentry event hint so that this type assertion succeeds at runtime.- Whether
hint.Context
here refers to Go'scontext.Context
interface and whethersentry.RequestContextKey
is a valid key for retrieving the Fiber context.If these are not guaranteed by the fibersentry implementation, users may encounter nil-assertion failures or type mismatches at runtime.
websocket/README.md (4)
15-15
: Compatibility and install instructions correctly reflect Fiber v3 + websocket v2.Fiber v3 import path and websocket/v2 module reference are appropriate. Since the PR focuses on v1 major bumps for other modules (circuitbreaker, hcaptcha, loadshed, monitor, testcontainers), the websocket/v2 path is expected.
Also applies to: 20-22
60-67
: Handler signatures properly updated for Fiber v3 value-style context.The middleware handler at line 60 correctly uses
fiber.Ctx
(value-style) instead of the pointer-style*fiber.Ctx
from Fiber v2. The websocket connection handler at line 70 appropriately retains*websocket.Conn
since it operates on the websocket connection object, not the Fiber context. Both are correct for Fiber v3 + websocket v2.Also applies to: 70-96
112-113
: Cache middleware config correctly uses Fiber v3 context API.The
Next
callback correctly uses value-stylefiber.Ctx
and calls.Route().Path
, which is valid in Fiber v3. Configuration pattern is appropriate.
130-140
: Recover middleware example correctly demonstrates Fiber v3 patterns.The cache middleware
Next
callback uses proper value-stylefiber.Ctx
, and theRecoverHandler
example is appropriately scoped to the websocket connection. The recovery pattern is sound and clear.jwt/jwt_test.go (1)
19-19
: LGTM! Import path correctly updated for v2 module.The import path change from
github.com/gofiber/contrib/jwt
togithub.com/gofiber/contrib/jwt/v2
correctly follows Go module versioning conventions for v2+ releases. All test usage remains unchanged, confirming API stability.jwt/README.md (2)
22-27
: Clear compatibility note and updated install instructions.The Fiber v3 compatibility note and updated install command correctly reflect the v2 module path. This helps users understand version requirements.
94-94
: All example imports consistently updated to v2 path.Every code example in the documentation now correctly imports
github.com/gofiber/contrib/jwt/v2
. This ensures users copying examples will use the correct module path.Also applies to: 168-168, 231-231, 341-341
fgprof/fgprof_test.go (3)
6-6
: LGTM: Import addition is necessary.The
strings
import is correctly added to support thestrings.Contains
calls in the streaming endpoint skip logic.
58-61
: Good workaround for streaming endpoint test limitations.The timeout increase and conditional skip appropriately handle the Fiber test helper's limitation with streaming endpoints while allowing the test to pass in environments where it works.
84-87
: LGTM: Appropriate handling for actual streaming endpoint.The timeout and skip logic correctly handle the case where the fgprof handler is actually invoked.
fiberzerolog/zerolog_test.go (1)
220-220
: LGTM! Protocol value updated to match Fiber v3.The test expectation now correctly reflects that Fiber v3 returns "HTTP/1.1" instead of "http" for the protocol field.
testcontainers/README.md (1)
19-21
: LGTM! Fiber v3 compatibility documented.The compatibility note appropriately documents support for Fiber v3, consistent with similar updates across other modules in this PR.
monitor/monitor.go (1)
79-79
: LGTM! Fiber v3 API signature update.Correctly updated to pass
fiber.Ctx
by value instead of by pointer, consistent with Fiber v3's API design where contexts are passed as values.monitor/monitor_test.go (3)
126-126
: LGTM! Test expectations updated for Fiber v3.Correctly updated to expect
MIMEApplicationJSONCharsetUTF8
("application/json; charset=utf-8") instead of plainMIMEApplicationJSON
, reflecting Fiber v3's behavior of including charset in JSON responses.
158-158
: LGTM! Benchmark assertion updated for Fiber v3.Correctly updated to expect the charset-aware MIME type constant, consistent with the test updates and Fiber v3's JSON response behavior.
192-192
: LGTM! API-only test updated for Fiber v3.The assertion correctly expects the charset-aware MIME type, maintaining consistency with other test updates in this file.
monitor/README.md (3)
17-22
: LGTM! Documentation updated for Fiber v3.The compatibility note and updated installation instructions appropriately document Fiber v3 support.
37-37
: LGTM! Signature documentation updated.The
Next
callback signature now correctly showsfunc(c fiber.Ctx) bool
(value receiver) instead of the pointer version, aligning with the actual code change in monitor/monitor.go line 79.
74-80
: LGTM! Code formatting improved.Consistent indentation using spaces instead of tabs improves readability in the default config example.
fiberzerolog/config.go (2)
212-237
: LGTM! Improved header handling for Fiber v3.The updated implementation correctly uses
fc.GetReqHeaders()
instead of low-levelVisitAll
traversal, and properly handles both single-valued and multi-valued headers:
- Single values: logged with
Str
(orDict.Str
when wrapped)- Multiple values: logged with
Strs
(orDict.Strs
when wrapped)This approach is more idiomatic and aligns with Fiber v3's API design.
245-270
: LGTM! Response header handling updated consistently.The response header logging follows the same improved pattern as request headers, using
fc.GetRespHeaders()
and correctly distinguishing between single and multi-valued headers.casbin/README.md (4)
13-14
: LGTM! Fiber v3 compatibility documented.The compatibility note appropriately indicates support for Fiber v3, consistent with the module's API updates.
39-41
: LGTM! Config table updated for Fiber v3 signatures.All callback function signatures correctly updated from
func(*fiber.Ctx)
tofunc(fiber.Ctx)
, reflecting the Fiber v3 API change where contexts are passed by value.
65-68
: LGTM! Example Lookup signature updated.The example correctly demonstrates the updated signature using value-type
fiber.Ctx
.
72-75
: LGTM! Handler signature updated.Route handler correctly uses value-type
fiber.Ctx
parameter, consistent with Fiber v3.circuitbreaker/README.md (4)
13-15
: LGTM! Fiber v3 compatibility documented.The compatibility note appropriately indicates this module now supports Fiber v3.
60-62
: LGTM! Circuit breaker callback signatures updated.All three callback signatures (
OnOpen
,OnClose
,OnHalfOpen
) correctly updated to:
- Accept
fiber.Ctx
by value (not pointer)- Return
error
(previously these callbacks didn't return errors based on the context)This aligns with Fiber v3's API design and provides better error handling capabilities.
96-98
: LGTM! Example handler signature updated.Handler function correctly uses value-type
fiber.Ctx
parameter, consistent with Fiber v3 conventions.
146-157
: LGTM! Custom callback examples updated.All three callback examples (
OnOpen
,OnClose
,OnHalfOpen
) correctly demonstrate:
- Value-type
fiber.Ctx
parameters- Error return values
- Proper Fiber v3 response methods
circuitbreaker/circuitbreaker_test.go (1)
716-716
: LGTM! Content-Type assertion correctly updated for Fiber v3.The test now correctly expects the charset parameter in the JSON Content-Type header, aligning with Fiber v3's response behavior.
socketio/README.md (4)
15-16
: LGTM! Fiber v3 compatibility clearly documented.The compatibility note appropriately informs users about the Fiber v3 requirement.
20-22
: LGTM! Install instructions correctly updated.The code fence is properly tagged with
sh
, and module paths are updated to v2 for both socketio and the Fiber framework.
31-31
: LGTM! Signature correctly updated to Fiber v3 convention.The change from
func(*fiber.Ctx) error
tofunc(fiber.Ctx) error
correctly reflects Fiber v3's value-based context parameter.
71-72
: LGTM! Example code correctly updated for v2 imports and Fiber v3 signatures.The imports reference the v2 module paths, and the middleware function signature correctly uses
fiber.Ctx
(value-based parameter) instead of*fiber.Ctx
(pointer), aligning with Fiber v3 conventions.Also applies to: 93-93
fiberi18n/README.md (3)
17-22
: LGTM! Fiber v3 compatibility and install instructions correctly updated.The compatibility note and install commands reflect the v3 module paths for both Fiber and fiberi18n.
29-30
: LGTM! Signature updates correctly reflect Fiber v3 conventions.All function signatures have been updated to use
fiber.Ctx
(value-based) instead of*fiber.Ctx
(pointer-based), aligning with Fiber v3's API changes.Also applies to: 36-36, 43-43
47-84
: LGTM! Example code correctly updated for Fiber v3.The example imports v3 module paths, uses value-based
fiber.Ctx
parameters, and demonstrates proper usage of the updated API withMessageID
andTemplateData
field names.loadshed/loadshed_test.go (1)
267-267
: LGTM! Content-Type assertion correctly updated for Fiber v3.The test expectation now correctly includes the charset parameter in the JSON Content-Type header, consistent with Fiber v3's response behavior and other test updates in this PR (e.g., circuitbreaker tests).
socketio/socketio_test.go (1)
12-12
: LGTM! Import path correctly updated to v2.The websocket import path is updated to
github.com/gofiber/contrib/websocket/v2
, consistent with the module version bump and the import change in socketio/socketio.go.socketio/socketio.go (1)
9-9
: LGTM! Import path correctly updated to v2.The websocket dependency import is updated to
github.com/gofiber/contrib/websocket/v2
, aligning with the module version bump. All API usage remains unchanged.fiberzap/logger_test.go (1)
234-234
: LGTM! SetLogger call correctly uses concrete type parameter.The explicit type parameter
[*zap.Logger]
correctly specifies the concrete logger type, aligning with the updated generic API signature in Fiber v3's logging interface.fiberzap/zap.go (1)
174-185
: LGTM! Header extraction refactored to use Fiber v3 API.The new implementation using
c.GetReqHeaders()
is cleaner and more idiomatic than the previousVisitAll
callback approach. The logic correctly handles:
- Skipping empty headers
- Single-valued headers logged with
zap.String
- Multi-valued headers logged with
zap.Strings
This aligns with the Fiber v3 header API changes and follows the same pattern adopted in other logging packages (e.g., fiberzerolog).
fiberzap/zap_test.go (2)
150-150
: LGTM! Test expectations properly updated for Fiber v3.The protocol value changed from "http" to "HTTP/1.1", aligning with Fiber v3's more specific protocol reporting. The response body and byte count updates are consistent: "Not Found" (9 bytes) replaces "Cannot GET /" (12 bytes) as the default 404 response.
Also applies to: 153-153, 155-155
475-475
: LGTM! Protocol expectation consistent with other tests.This matches the protocol string update applied in Test_Logger_All, ensuring consistency across the test suite.
fiberzap/README.md (3)
17-17
: LGTM! Clear v3 compatibility documentation.The compatibility notice and versioned import paths (
fiberzap/v3
) properly reflect the v3 release.Also applies to: 19-23
35-35
: LGTM! Config signatures correctly updated to Fiber v3 API.The callback signatures properly use value-type
fiber.Ctx
instead of pointer*fiber.Ctx
, consistent with Fiber v3's interface-based context design.Also applies to: 42-42
53-53
: LGTM! Example code properly updated for Fiber v3.All handler signatures consistently use value-type
fiber.Ctx
, and import paths correctly referencefiberzap/v3
. The addition of thecontext
import is properly utilized in the second example.Also applies to: 66-66, 97-100, 111-111, 116-116
loadshed/README.md (3)
17-22
: LGTM! Install commands correctly reflect v1 release.The import path
github.com/gofiber/contrib/loadshed
correctly omits the version suffix, following Go's convention that v1 modules don't require/v1
in the path. The Fiber v3 compatibility notice is clear.
58-58
: LGTM! Handler signatures properly updated to Fiber v3 API.All handler and callback signatures consistently use value-type
fiber.Ctx
, aligning with Fiber v3's interface-based context design.Also applies to: 88-88, 103-103
117-119
: LGTM! Config documentation and formula formatting improved.The config table signatures are correctly updated to use value-type
fiber.Ctx
. The addition of a code fence for the rejection probability formula enhances readability.Also applies to: 147-149
fiberi18n/example/main.go (1)
6-6
: Import path update verified for Fiber v3 migration.The fiberi18n/v3 module is properly published and compatible. API signatures confirm
fiber.Ctx
is passed as a value type (not pointer), matching the correct v3 style already used in the example handlers. No additional code changes required.swagger/README.md (3)
35-35
: Import path updates for Fiber v3 compatibility are clear and well-documented.The migration from unversioned to
/v2
module paths is consistent with the PR's versioning strategy and clearly communicated in both the installation (line 35) and examples (line 43) sections.Also applies to: 43-43
150-151
: Fiber v3 compatibility note is a helpful addition.Explicitly documenting compatibility with Fiber v3 is valuable for users migrating their applications.
104-104
: Verification complete: swagger implementation correctly usesfiber.Ctx
interface.The swagger module's Config struct in
swagger/swagger.go
correctly defines the Next field asfunc(c fiber.Ctx) bool
, which is the Fiber v3 interface-based syntax. The implementation aligns with the documented behavior and is consistent across all middleware modules in the codebase.opafiber/README.md (3)
15-23
: LGTM!The compatibility note and installation instructions correctly reflect the Fiber v3 upgrade and the new module path
github.com/gofiber/contrib/opafiber/v3
.
42-47
: LGTM!The function signature updates from
*fiber.Ctx
tofiber.Ctx
are consistent with Fiber v3's value-based context API. The documentation accurately reflects the code changes in the Config and type definitions.
72-111
: LGTM!The usage example correctly demonstrates Fiber v3 integration with updated imports, value-based
fiber.Ctx
parameters, and proper module paths. The addition of thebytes
import for policy construction is appropriate.fibernewrelic/fiber.go (1)
119-119
: LGTM!The change to use
c.Context()
correctly aligns with Fiber v3's context handling. In v3,c.Context()
returns the standard Gocontext.Context
, which is whatnewrelic.FromContext()
expects. This is consistent with the pattern used on line 100 where the transaction is stored in the context.Based on learnings
fibernewrelic/README.md (4)
15-23
: LGTM!The compatibility note and installation instructions correctly reflect Fiber v3 support with the updated module path
github.com/gofiber/contrib/fibernewrelic/v2
.
40-41
: LGTM!The Config property signatures correctly updated from
*fiber.Ctx
tofiber.Ctx
to align with Fiber v3's value-based context interface.
50-114
: LGTM!The usage examples correctly demonstrate Fiber v3 integration with updated imports, value-based
fiber.Ctx
parameters, and proper configuration patterns for both standalone and existing NewRelic application scenarios.
97-105
: ****The review comment is based on an incorrect assumption. While the fibernewrelic package does provide a
FromContext(c *fiber.Ctx)
function, all official Fiber documentation examples usenewrelic.FromContext(ctx)
directly from the NewRelic library. The codebase implementation (fiber.go:119) also follows this pattern withnewrelic.FromContext(c.Context())
. The README example is consistent with the recommended and documented usage pattern—no changes are needed.Likely an incorrect or invalid review comment.
otelfiber/fiber.go (1)
176-179
: Injecting tracing headers from c.Context() is correct for v3.Good update to pass a context.Context into Inject and reflect outbound headers on the response.
otelfiber/example/server.go (1)
12-12
: Import path bump to otelfiber/v3 looks good.Matches the module path and v3 migration.
otelfiber/doc.go (1)
6-6
: Module import comment updated to /v3 — OK.Consistent with the package rename and tests.
otelfiber/README.md (3)
19-22
: Verify import path and compatibility messaging.The import path is correctly updated to
otelfiber/v3
and the compatibility note clearly indicates Fiber v3 support. However, ensure this is the final import path agreed upon (following the PR objective to clarify that v1 modules omit the/v1
suffix). The messaging here states v3 explicitly, which is appropriate for this middleware.
37-37
: Function signatures correctly reflect Fiber v3's value-receiver API.The config table correctly documents the breaking API changes from Fiber v2 to v3:
WithNext
:func(*fiber.Ctx) bool
→func(fiber.Ctx) bool
WithSpanNameFormatter
:func(*fiber.Ctx) string
→func(fiber.Ctx) string
WithCustomAttributes
:func(*fiber.Ctx) []attribute.KeyValue
→func(fiber.Ctx) []attribute.KeyValue
WithCustomMetricAttributes
:func(*fiber.Ctx) []attribute.KeyValue
→func(fiber.Ctx) []attribute.KeyValue
These changes are aligned with Fiber v3's move from pointer to value receivers. The documentation clearly communicates these breaking changes.
Also applies to: 43-45
42-42
: Breaking change (WithServerName removal) is well‑documented.The removal of
WithServerName
is clearly explained with rationale (deprecation in OpenTelemetry semconv, replacement withserver.address
using hostname). Users will understand why this option no longer exists and what to use instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
v3/opafiber/fiber.go (1)
50-53
: Duplicate query parameters are lost with this approach.As noted in previous reviews,
QueryArgs().All()
returns a map that cannot preserve duplicate keys (e.g.,?tag=foo&tag=bar
will only keep the last value). Theappend
pattern on line 52 suggests the intent is to collect all values, but the map iteration won't provide them. UseQueryArgs().VisitAll()
to properly iterate all query parameters including duplicates.v3/otelfiber/semconv.go (1)
87-94
: URL scheme derivation misreports HTTPS behind proxies/TLS terminators.This issue has been previously identified in past review comments. The
requestScheme
helper usesURI().Scheme()
which defaults to"http"
and ignores Fiber's TLS detection and theX-Forwarded-Proto
header. This will result in incorrect telemetry (spans and metrics reportinghttp
instead ofhttps
) for secure deployments behind load balancers or reverse proxies.The suggested fix from previous reviews is to use a fallback chain: check
c.Protocol()
first, thenX-Forwarded-Proto
, thenURI().Scheme()
, and finally default to"http"
.v3/fgprof/README.md (1)
31-31
: Fix trailing period in the Prefix type definition.This issue was previously flagged. The
Prefix
type should bestring
without the trailing period.Apply this diff to fix the formatting:
-| Prefix | `string`. | Prefix defines a URL prefix added before "/debug/fgprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" | `""` | +| Prefix | `string` | Prefix defines a URL prefix added before "/debug/fgprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" | `""` |
🧹 Nitpick comments (7)
v3/socketio/README.md (1)
15-15
: Minor: Emphasis used instead of a heading.The line "Compatible with Fiber v3." uses emphasis but reads like a section heading. Consider converting to a proper heading using
##
for consistency with documentation structure. However, this is a stylistic preference and not required.v3/fiberzap/README.md (1)
33-42
: API signatures correctly updated for v3; grammar issue in Config table.The
Next
(line 35) andGetResBody
(line 42) signatures are properly updated to use value receivers. However, the description on line 37 contains a grammar error: "Add fields what you want see" should read "Add fields you want to see" or "Add the fields you want to see."Apply this diff to fix the grammar:
-| Fields | `[]string` | Add fields what you want see. | `[]string{"latency", "status", "method", "url"}` | +| Fields | `[]string` | Add fields you want to see. | `[]string{"latency", "status", "method", "url"}` |v3/circuitbreaker/README.md (1)
166-166
: Minor: Extra asterisk in Markdown formatting.Line 166 contains an extra asterisk: "*custom error responses" should be "custom error responses" for proper emphasis.
Apply this diff to fix the formatting:
-✅ Now, when failures exceed the threshold, ***custom error responses** will be sent. +✅ Now, when failures exceed the threshold, **custom error responses** will be sent.v3/fiberi18n/README.md (2)
17-17
: Fix markdown linting: use heading instead of emphasis for v3 compatibility note.Line 17 uses emphasis (
**...**
) which is rendered as bold text. Per markdownlint rules (MD036), this should be converted to a proper heading or structural element. Consider restructuring this section, for example:## Fiber v3 Compatibility Compatible with Fiber v3.
Alternatively, if you prefer to keep it inline with the note above, restructure it differently, but avoid using emphasis syntax for what should be a section highlight.
62-62
: Fix markdown linting: wrap bare URL in link syntax.Line 62 contains a bare URL which triggers markdownlint rule MD034. Wrap it in proper markdown link syntax:
- https://docs.gofiber.io/guide/extractors + [Fiber Extractors Guide](https://docs.gofiber.io/guide/extractors)v3/paseto/README.md (1)
21-21
: Fix markdown linting: convert emphasis to proper heading for v3 compatibility note.Similar to fiberi18n, line 21 uses emphasis (
**Compatible with Fiber v3.**
) which should be converted to a proper heading or structural element per markdownlint MD036. Apply consistent formatting across README files:## Fiber v3 Compatibility Compatible with Fiber v3.
v3/otelfiber/README.md (1)
19-19
: Fix markdown linting: convert emphasis to proper heading for v3 compatibility note.For consistency with documentation standards and to address markdownlint MD036, convert the emphasis-styled compatibility note to a proper heading or structural element:
## Fiber v3 Compatibility Compatible with Fiber v3.
Apply this consistently across all README files (opafiber, fiberi18n, paseto, otelfiber).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (73)
.github/ISSUE_TEMPLATE/bug-report.yaml
is excluded by!**/*.yaml
.github/ISSUE_TEMPLATE/feature-request.yaml
is excluded by!**/*.yaml
.github/ISSUE_TEMPLATE/question.yaml
is excluded by!**/*.yaml
.github/release-drafter-template.yml
is excluded by!**/*.yml
.github/workflows/golangci-lint.yml
is excluded by!**/*.yml
.github/workflows/test-casbin.yml
is excluded by!**/*.yml
.github/workflows/test-circuitbreaker.yml
is excluded by!**/*.yml
.github/workflows/test-fgprof.yml
is excluded by!**/*.yml
.github/workflows/test-fiberi18n.yml
is excluded by!**/*.yml
.github/workflows/test-fibernewrelic.yml
is excluded by!**/*.yml
.github/workflows/test-fibersentry.yml
is excluded by!**/*.yml
.github/workflows/test-fiberzap.yml
is excluded by!**/*.yml
.github/workflows/test-fiberzerolog.yml
is excluded by!**/*.yml
.github/workflows/test-hcaptcha.yml
is excluded by!**/*.yml
.github/workflows/test-jwt.yml
is excluded by!**/*.yml
.github/workflows/test-loadshed.yml
is excluded by!**/*.yml
.github/workflows/test-monitor.yml
is excluded by!**/*.yml
.github/workflows/test-opafiber.yml
is excluded by!**/*.yml
.github/workflows/test-otelfiber.yml
is excluded by!**/*.yml
.github/workflows/test-paseto.yml
is excluded by!**/*.yml
.github/workflows/test-socketio.yml
is excluded by!**/*.yml
.github/workflows/test-swagger.yml
is excluded by!**/*.yml
.github/workflows/test-testcontainers.yml
is excluded by!**/*.yml
.github/workflows/test-websocket.yml
is excluded by!**/*.yml
go.work
is excluded by!**/*.work
,!**/*.work
v3/casbin/go.mod
is excluded by!**/*.mod
v3/casbin/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/circuitbreaker/go.mod
is excluded by!**/*.mod
v3/circuitbreaker/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fgprof/go.mod
is excluded by!**/*.mod
v3/fgprof/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fiberi18n/example/localize/en.yaml
is excluded by!**/*.yaml
v3/fiberi18n/example/localize/zh.yaml
is excluded by!**/*.yaml
v3/fiberi18n/example/localizeJSON/en.json
is excluded by!**/*.json
v3/fiberi18n/example/localizeJSON/zh.json
is excluded by!**/*.json
v3/fiberi18n/go.mod
is excluded by!**/*.mod
v3/fiberi18n/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fibernewrelic/go.mod
is excluded by!**/*.mod
v3/fibernewrelic/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fibersentry/go.mod
is excluded by!**/*.mod
v3/fibersentry/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fiberzap/go.mod
is excluded by!**/*.mod
v3/fiberzap/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/fiberzerolog/go.mod
is excluded by!**/*.mod
v3/fiberzerolog/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/hcaptcha/go.mod
is excluded by!**/*.mod
v3/hcaptcha/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/jwt/go.mod
is excluded by!**/*.mod
v3/jwt/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/loadshed/go.mod
is excluded by!**/*.mod
v3/loadshed/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/monitor/go.mod
is excluded by!**/*.mod
v3/monitor/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/opafiber/go.mod
is excluded by!**/*.mod
v3/opafiber/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/otelfiber/example/docker-compose.yml
is excluded by!**/*.yml
v3/otelfiber/example/go.mod
is excluded by!**/*.mod
v3/otelfiber/example/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/otelfiber/go.mod
is excluded by!**/*.mod
v3/otelfiber/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/paseto/go.mod
is excluded by!**/*.mod
v3/paseto/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/socketio/go.mod
is excluded by!**/*.mod
v3/socketio/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/swagger/go.mod
is excluded by!**/*.mod
v3/swagger/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/swagger/swagger.json
is excluded by!**/*.json
v3/swagger/swagger.yaml
is excluded by!**/*.yaml
v3/swagger/swagger_missing.json
is excluded by!**/*.json
v3/testcontainers/go.mod
is excluded by!**/*.mod
v3/testcontainers/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/websocket/go.mod
is excluded by!**/*.mod
v3/websocket/go.sum
is excluded by!**/*.sum
,!**/*.sum
📒 Files selected for processing (45)
README.md
(1 hunks)v3/casbin/README.md
(8 hunks)v3/circuitbreaker/README.md
(10 hunks)v3/circuitbreaker/circuitbreaker_test.go
(1 hunks)v3/fgprof/README.md
(2 hunks)v3/fgprof/fgprof_test.go
(3 hunks)v3/fiberi18n/README.md
(1 hunks)v3/fiberi18n/example/main.go
(1 hunks)v3/fibernewrelic/README.md
(4 hunks)v3/fibernewrelic/fiber.go
(1 hunks)v3/fibernewrelic/fiber_test.go
(1 hunks)v3/fibersentry/README.md
(2 hunks)v3/fiberzap/README.md
(6 hunks)v3/fiberzap/logger_test.go
(1 hunks)v3/fiberzap/zap.go
(1 hunks)v3/fiberzap/zap_test.go
(2 hunks)v3/fiberzerolog/README.md
(4 hunks)v3/fiberzerolog/config.go
(1 hunks)v3/fiberzerolog/zerolog_test.go
(1 hunks)v3/hcaptcha/README.md
(4 hunks)v3/jwt/README.md
(7 hunks)v3/jwt/jwt_test.go
(1 hunks)v3/loadshed/README.md
(8 hunks)v3/loadshed/loadshed_test.go
(1 hunks)v3/monitor/README.md
(4 hunks)v3/monitor/monitor.go
(1 hunks)v3/monitor/monitor_test.go
(3 hunks)v3/opafiber/README.md
(3 hunks)v3/opafiber/fiber.go
(1 hunks)v3/otelfiber/README.md
(3 hunks)v3/otelfiber/doc.go
(1 hunks)v3/otelfiber/example/server.go
(1 hunks)v3/otelfiber/fiber.go
(5 hunks)v3/otelfiber/otelfiber_test/fiber_test.go
(18 hunks)v3/otelfiber/semconv.go
(3 hunks)v3/paseto/README.md
(10 hunks)v3/socketio/README.md
(4 hunks)v3/socketio/socketio.go
(1 hunks)v3/socketio/socketio_test.go
(1 hunks)v3/swagger/README.md
(2 hunks)v3/testcontainers/README.md
(5 hunks)v3/testcontainers/examples_test.go
(1 hunks)v3/testcontainers/testcontainers_test.go
(1 hunks)v3/websocket/README.md
(3 hunks)v3/websocket/websocket_test.go
(0 hunks)
💤 Files with no reviewable changes (1)
- v3/websocket/websocket_test.go
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#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-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#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:
v3/fgprof/fgprof_test.go
v3/testcontainers/testcontainers_test.go
v3/otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
PR: gofiber/fiber#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:
v3/fgprof/fgprof_test.go
v3/otelfiber/otelfiber_test/fiber_test.go
v3/loadshed/loadshed_test.go
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
PR: gofiber/fiber#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:
v3/fibernewrelic/fiber.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
PR: gofiber/fiber#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:
v3/fibernewrelic/fiber.go
📚 Learning: 2024-10-02T23:03:31.727Z
Learnt from: sixcolors
PR: gofiber/fiber#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:
v3/testcontainers/testcontainers_test.go
v3/otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
PR: gofiber/fiber#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:
v3/testcontainers/testcontainers_test.go
📚 Learning: 2024-07-03T11:59:00.303Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Applied to files:
v3/fiberi18n/example/main.go
v3/fiberi18n/README.md
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
PR: gofiber/fiber#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:
v3/websocket/README.md
v3/otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
v3/otelfiber/README.md
v3/fgprof/README.md
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
PR: gofiber/fiber#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:
v3/fgprof/README.md
🪛 LanguageTool
v3/fiberzap/README.md
[grammar] ~37-~37: Ensure spelling is correct
Context: ...[]string
| Add fields what you want see. ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 markdownlint-cli2 (0.18.1)
v3/casbin/README.md
15-15: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
22-22: Link text should be descriptive
(MD059, descriptive-link-text)
v3/circuitbreaker/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/fiberi18n/README.md
18-18: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
62-62: Bare URL used
(MD034, no-bare-urls)
v3/fibernewrelic/README.md
18-18: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
62-62: Bare URL used
(MD034, no-bare-urls)
🔇 Additional comments (67)
v3/fiberzerolog/zerolog_test.go (1)
220-220
: LGTM! Test expectation updated for Fiber v3 protocol format.The protocol field now correctly expects "HTTP/1.1" instead of "http", aligning with Fiber v3's more detailed protocol version reporting.
v3/circuitbreaker/circuitbreaker_test.go (1)
716-716
: LGTM! Test expectation updated for Fiber v3 Content-Type header.The Content-Type assertion now correctly expects the charset parameter, consistent with Fiber v3's JSON response header format.
v3/loadshed/loadshed_test.go (1)
267-267
: LGTM! Test expectation updated for Fiber v3 Content-Type header.The Content-Type assertion now correctly expects the charset parameter, consistent with Fiber v3's JSON response header format.
v3/jwt/jwt_test.go (1)
19-19
: LGTM! Import path correctly updated to v3.The JWT middleware import path is properly migrated to the v3 module path.
v3/fiberi18n/example/main.go (1)
6-6
: LGTM! Import path correctly updated to v3.The fiberi18n import path is properly migrated to the v3 module path.
v3/fibernewrelic/fiber.go (1)
119-119
: LGTM! Correctly adapted for Fiber v3 context API.The change from
c
toc.Context()
correctly retrieves the standard Go context for NewRelic's FromContext function, aligning with Fiber v3's context handling improvements.v3/fgprof/fgprof_test.go (3)
6-6
: LGTM! Import added for error message detection.The
strings
import is correctly added to support the empty response detection logic.
58-61
: LGTM! Appropriate workaround for streaming endpoint testing.The timeout increase to 3000ms and skip logic properly handle the known limitation where Fiber's test helper cannot fully support streaming responses. This prevents flaky test failures while still validating the middleware for non-streaming scenarios.
77-80
: LGTM! Consistent error handling for streaming tests.The same timeout increase and skip pattern is correctly applied to all streaming endpoint tests, ensuring consistent test behavior.
Also applies to: 84-87
v3/otelfiber/example/server.go (1)
12-12
: LGTM! Import path updated for v3 compatibility.The import path has been correctly updated to the v3 module path, consistent with the Fiber v3 migration.
v3/fibernewrelic/fiber_test.go (1)
389-394
: LGTM! Proper nil-guarding for segment creation.The test now asserts that the transaction is non-nil and guards segment creation accordingly. This is good defensive coding that prevents potential nil pointer dereferences while maintaining test coverage.
v3/otelfiber/fiber.go (5)
8-8
: LGTM! Internal import path updated for v3.The internal package import has been correctly updated to the v3 module path.
23-23
: LGTM! Instrumentation name updated for v3.The instrumentation name constant now correctly references the v3 module path, ensuring proper telemetry attribution.
113-117
: LGTM! Header extraction updated for Fiber v3 API.The change from
VisitAll
toGetReqHeaders()
properly handles the new Fiber v3 API that returns headers asmap[string][]string
, correctly iterating over multi-valued headers.
166-166
: LGTM! Context properly restored.The saved context is correctly restored before cancellation in the defer block, ensuring proper context lifecycle management.
178-178
: LGTM! Propagation uses correct context.The propagators now correctly inject headers using
c.Context()
which contains the trace context, rather than the Fiber context instance.v3/otelfiber/otelfiber_test/fiber_test.go (5)
10-10
: LGTM! Time package import added.The
time
package import is correctly added to support the updated timeout syntax usingtime.Second
.
12-12
: LGTM! Import path updated for v3.The otelfiber import has been correctly updated to the v3 module path.
32-32
: LGTM! Instrumentation name updated for v3.The instrumentation name constant now correctly references the v3 module path for proper test validation.
45-47
: LGTM! Improved error handling in tests.Tests now properly capture response and error values from
app.Test()
and assert them usingrequire.NoError
andrequire.NotNil
. This provides better test coverage and clearer failure messages when tests fail.Also applies to: 64-66, 86-88, 144-146, 174-176, 190-192, 217-219, 248-250, 314-316, 491-493, 596-598, 634-636
109-109
: LGTM! Improved timeout readability.Timeout values have been updated from numeric milliseconds to
3 * time.Second
, which is more readable and maintainable.Also applies to: 445-445, 533-533, 565-565
v3/fiberzerolog/config.go (2)
212-237
: LGTM! Proper multi-valued header handling for request headers.The updated implementation correctly handles the new Fiber v3 API where
GetReqHeaders()
returnsmap[string][]string
. The code properly:
- Skips empty header values
- Uses
Str
for single-valued headers- Uses
Strs
for multi-valued headers- Handles both wrapped and unwrapped header logging
245-270
: LGTM! Proper multi-valued header handling for response headers.The updated implementation correctly handles the new Fiber v3 API where
GetRespHeaders()
returnsmap[string][]string
. The code properly:
- Skips empty header values
- Uses
Str
for single-valued headers- Uses
Strs
for multi-valued headers- Handles both wrapped and unwrapped header logging
v3/fibersentry/README.md (3)
17-17
: LGTM! Documentation updated for v3 compatibility.The documentation correctly indicates compatibility with Fiber v3.
21-21
: LGTM! Import paths updated for v3.The installation instructions and example imports have been correctly updated to use the v3 module path.
Also applies to: 55-55
65-65
: LGTM! Type assertions updated for Fiber v3 API.The type assertions in the
BeforeSend
callback examples have been correctly updated from*fiber.Ctx
(pointer) tofiber.Ctx
(value), reflecting the breaking change in Fiber v3 where the context is passed by value rather than by pointer.Also applies to: 116-116
v3/otelfiber/doc.go (1)
6-6
: LGTM! Package import annotation updated for v3.The package documentation has been correctly updated to reference the v3 module path.
v3/testcontainers/examples_test.go (1)
9-9
: LGTM! Import path correctly updated for v3.The import path has been properly updated to use the v3 module path, consistent with the PR's objectives.
v3/socketio/socketio.go (1)
9-9
: LGTM! Websocket import correctly migrated to v3.The websocket dependency import has been properly updated to the v3 module path.
v3/testcontainers/testcontainers_test.go (1)
8-8
: LGTM! Test import correctly updated for v3.The test file import has been properly updated to use the v3 module path.
v3/socketio/socketio_test.go (1)
12-12
: LGTM! Websocket test import correctly migrated to v3.The aliased websocket import has been properly updated to the v3 module path while preserving the
fws
alias.v3/monitor/monitor.go (1)
79-79
: LGTM! Next callback signature updated for v3.The Next predicate now receives
fiber.Ctx
by value instead of by pointer, consistent with Fiber v3's API changes. Based on learningsv3/fiberzap/logger_test.go (1)
234-234
: LGTM! Type parameter made more specific.The type parameter has been correctly changed from
any
to*zap.Logger
, providing better type safety while maintaining the same functionality.v3/monitor/monitor_test.go (3)
126-126
: LGTM! Test expectations updated for v3 JSON response headers.The expected Content-Type has been correctly updated to include the charset, which aligns with Fiber v3's behavior where the
JSON()
method setsapplication/json; charset=utf-8
.
158-158
: LGTM! Benchmark expectation aligned with v3.The Content-Type expectation in the benchmark is correctly updated to match Fiber v3's JSON response behavior.
192-192
: LGTM! APIOnly test expectation updated.The Content-Type expectation is correctly updated for the APIOnly mode test, consistent with v3's JSON response headers.
v3/fiberzap/zap.go (1)
174-185
: LGTM! Request headers logging refactored for v3 API.The headers logging has been properly updated to use
GetReqHeaders()
which returns amap[string][]string
. The logic correctly handles:
- Skipping headers with no values
- Logging single-value headers as strings
- Logging multi-value headers as string arrays
This is cleaner and more idiomatic than the previous iteration-based approach.
v3/websocket/README.md (2)
15-23
: LGTM! v3 compatibility documentation is clear.The compatibility note and updated installation instructions correctly reflect the v3 module path migration.
51-101
: LGTM! Import paths and examples updated correctly.All import paths and code examples have been consistently updated to reference the v3 module paths.
v3/fiberzap/zap_test.go (2)
150-156
: LGTM! Test expectations correctly updated for Fiber v3.The updated assertions reflect Fiber v3's behavior changes:
- Protocol now reports as "HTTP/1.1" (more standards-compliant)
- Default 404 response changed from "Cannot GET /" to "Not Found"
- Byte count correctly adjusted to 9 bytes for the new message
475-475
: LGTM! Protocol expectation consistent with v3 changes.The protocol field correctly expects "HTTP/1.1" to match Fiber v3's behavior.
v3/hcaptcha/README.md (2)
19-33
: LGTM! v3 compatibility and installation instructions updated correctly.The compatibility note and installation commands properly reference the v3 module path.
55-83
: LGTM! Import path and example updated for v3.The code example correctly uses the v3 import path and formatting is consistent.
v3/jwt/README.md (5)
22-27
: LGTM! v3 compatibility note and installation updated correctly.The documentation properly indicates Fiber v3 compatibility and references the correct v3 module paths.
94-156
: LGTM! HS256 example updated for v3.Import paths correctly reference the v3 module and code formatting is consistent.
168-186
: LGTM! Cookie extractor example updated for v3.Import path correctly references the v3 module.
231-311
: LGTM! RS256 example updated for v3.Import path and code example correctly reference the v3 module.
341-370
: LGTM! Custom KeyFunc example updated for v3.Import path correctly references the v3 module.
README.md (1)
20-41
: LGTM! Root README links updated to v3 structure.All middleware and service implementation links correctly point to the v3 subdirectory, maintaining consistency with the v3 module migration.
v3/swagger/README.md (3)
35-44
: LGTM! Installation and import paths updated for v3.The installation command and import statement correctly reference the v3 module path.
101-148
: LGTM! Config documentation formatting improved.The Config type documentation has been reformatted for better readability with consistent comment structure.
151-152
: LGTM! v3 compatibility note added.The compatibility statement clearly indicates Fiber v3 support.
v3/testcontainers/README.md (3)
19-40
: LGTM! v3 compatibility and installation instructions updated.The compatibility note and installation commands properly reference the v3 module path.
214-230
: LGTM! Examples link and import path updated for v3.The examples reference and import statement correctly use the v3 module path.
279-280
: LGTM! Import path updated for v3 in custom container example.The import statement correctly references the v3 module path.
v3/fgprof/README.md (3)
17-24
: LGTM! v3 compatibility and installation instructions updated.The compatibility note and installation commands correctly reference the v3 module path.
30-30
: Note: API signature change is expected for v3.The
Next
function signature changed fromfunc(c *fiber.Ctx) bool
tofunc(c fiber.Ctx) bool
, passing the context by value instead of by pointer. This is a breaking change that aligns with Fiber v3's updated API surface.Based on learnings
39-52
: LGTM! Import paths and example updated for v3.The code example correctly uses the v3 import paths and the callback signature matches the v3 API (value-based
fiber.Ctx
).v3/fibernewrelic/README.md (1)
40-41
: API signatures correctly updated for v3.The
ErrorStatusCodeHandler
andNext
field signatures are properly updated to use value receivers (fiber.Ctx
instead of*fiber.Ctx
), consistent with Fiber v3 conventions. Import paths and examples throughout the file correctly reflect the v3 migration.v3/loadshed/README.md (1)
117-119
: API signatures correctly updated for v3.The
Next
andOnShed
function signatures are properly updated to use value receivers. Examples at lines 58, 88, and 103 correctly demonstrate the new handler signatures usingfunc(c fiber.Ctx) error
.v3/monitor/README.md (1)
32-41
: API signatures correctly updated for v3.The
Next
field signature on line 37 is properly updated tofunc(c fiber.Ctx) bool
(value receiver). Import path and example usage are consistent with the v3 migration pattern.v3/casbin/README.md (1)
34-41
: API signatures correctly updated for v3.The
Lookup
,Unauthorized
, andForbidden
function signatures are properly updated to use value receivers (fiber.Ctx
instead of*fiber.Ctx
). All example code blocks correctly demonstrate the new signatures with handlers acceptingfiber.Ctx
as values.v3/fiberzerolog/README.md (1)
33-44
: API signatures correctly updated for v3.The
Next
(line 35),GetLogger
(line 37), andGetResBody
(line 44) function signatures are properly updated to use value receivers. All examples and code samples correctly reflect the v3 migration with proper handler signatures acceptingfiber.Ctx
as values.v3/circuitbreaker/README.md (1)
53-62
: API signatures correctly updated for v3.The
OnOpen
,OnClose
, andOnHalfOpen
callback signatures are properly updated to use value receivers (lines 60–62). All extensive examples throughout the file (lines 96–162, 174–181, 198–201, 233–239) correctly demonstrate the new function signatures withfunc(c fiber.Ctx) error
handlers.v3/opafiber/README.md (1)
15-22
: v3 compatibility note and import paths updated correctly.The Fiber v3 compatibility notice is clear, and the import paths now correctly reference
github.com/gofiber/contrib/v3/opafiber
. The signature change from*fiber.Ctx
tofiber.Ctx
is consistently reflected in the types table and documentation.v3/paseto/README.md (1)
107-432
: v3 import paths and API signatures consistently documented.The paseto README clearly documents:
- Updated import paths (
github.com/gofiber/contrib/v3/paseto
)- Signature changes from
*fiber.Ctx
tofiber.Ctx
in extractors- Multiple comprehensive examples demonstrating local tokens, custom validators, cookie extraction, query extraction, and public/private key usage
- Migration guidance from TokenPrefix to the new Extractor pattern
All code examples use the updated v3 API correctly.
v3/otelfiber/README.md (1)
37-45
: v3 signature updates and WithServerName removal clearly documented.All option function signatures correctly reflect the change from
*fiber.Ctx
tofiber.Ctx
value receivers:
WithNext
,WithSpanNameFormatter
,WithCustomAttributes
,WithCustomMetricAttributes
all show proper value receiver signatures- The removal of
WithServerName
is clearly marked with rationale (deprecated in OpenTelemetry semconv v1.12.0+, replaced byserver.address
attribute)The documentation accurately reflects the v3 API surface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
v3/newrelic/fiber.go (1)
86-97
: Scheme derivation may misreport behind TLS/proxies; prefer Fiber-aware detection.
URI().Scheme()
is often empty with TLS or reverse proxies; this can mark HTTPS as HTTP in New Relic.Use a helper that prefers
c.Protocol()
thenX-Forwarded-Proto
, then URI scheme:- scheme := c.Request().URI().Scheme() - - txn.SetWebRequest(newrelic.WebRequest{ + sch := requestScheme(c) + txn.SetWebRequest(newrelic.WebRequest{ Host: host, Method: method, - Transport: transport(string(scheme)), + Transport: transport(sch), URL: &url.URL{ Host: host, - Scheme: string(c.Request().URI().Scheme()), + Scheme: sch, Path: string(c.Request().URI().Path()), RawQuery: string(c.Request().URI().QueryString()), }, })Add helper (place near
transport
):func requestScheme(c fiber.Ctx) string { if p := c.Protocol(); p == "http" || p == "https" { return p } if xfp := c.Get(fiber.HeaderXForwardedProto); xfp != "" { v := strings.TrimSpace(strings.Split(xfp, ",")[0]) if v == "http" || v == "https" { return v } } if s := c.Request().URI().Scheme(); len(s) > 0 { return string(s) } return "http" }This also keeps
transport()
correct.v3/otel/example/server.go (2)
12-22
: Import name collision: alias contrib otel to avoid clash with go.opentelemetry.io/otel.Both packages are named “otel,” causing an import name conflict and misreferences.
Apply:
@@ - "github.com/gofiber/fiber/v3" - - "github.com/gofiber/contrib/v3/otel" - "go.opentelemetry.io/otel" + "github.com/gofiber/fiber/v3" + + fiberotel "github.com/gofiber/contrib/v3/otel" + otelapi "go.opentelemetry.io/otel" @@ -var tracer = otel.Tracer("fiber-server") +var tracer = otelapi.Tracer("fiber-server") @@ -//app.Use(otel.Middleware(otel.WithSpanNameFormatter(func(ctx fiber.Ctx) string { +//app.Use(fiberotel.Middleware(fiberotel.WithSpanNameFormatter(func(ctx fiber.Ctx) string { @@ -app.Use(otel.Middleware()) +app.Use(fiberotel.Middleware())
47-51
: Wrong JSON map key: using variable instead of "name" literal.This produces a key equal to the user’s name rather than "name".
Use a string literal:
- return c.JSON(fiber.Map{"id": id, name: name}) + return c.JSON(fiber.Map{"id": id, "name": name})v3/zap/zap.go (1)
111-116
: Logged error is always nil — use chainErr.You append zap.Error(err), but err is the named return value that remains nil; the actual error is chainErr.
- fields = append(fields, zap.Error(err)) + if chainErr != nil { + fields = append(fields, zap.Error(chainErr)) + }v3/otel/otel_test/fiber_test.go (1)
394-403
: Out-of-bounds bug in histogram: increments the bounds slice instead of the last bucket.This panics for values above the last bound and corrupts data. Increment the extra bucket in bucketCounts.
- if i == len(bounds)-1 { - bounds[i+1]++ - break - } + if i == len(bounds)-1 { + bucketCounts[i+1]++ + break + }
♻️ Duplicate comments (2)
v3/otel/semconv.go (1)
22-25
: URL scheme detection ignores TLS/proxies; fixrequestScheme
to avoid mislabeling HTTPS.Using
URI().Scheme()
defaults to empty for TLS and proxy setups; spans/metrics gethttp
incorrectly.Apply this change to
requestScheme
:func requestScheme(c fiber.Ctx) string { - scheme := c.Request().URI().Scheme() - if len(scheme) == 0 { - return "http" - } - - return utils.CopyString(string(scheme)) + if p := c.Protocol(); p == "http" || p == "https" { + return utils.CopyString(p) + } + if xfp := c.Get(fiber.HeaderXForwardedProto); xfp != "" { + v := strings.TrimSpace(strings.Split(xfp, ",")[0]) + if v == "http" || v == "https" { + return utils.CopyString(v) + } + } + if sch := c.Request().URI().Scheme(); len(sch) > 0 { + return utils.CopyString(string(sch)) + } + return "http" }No call‑site changes needed; this fixes both usages at Lines 22 and 46.
Also applies to: 46-47, 87-94
v3/opa/fiber.go (1)
50-53
: Critical: Query parameter handling still loses duplicate keys.This issue was flagged in previous reviews but remains unaddressed. The current implementation uses
QueryArgs().All()
which returns a map, causing duplicate query parameters (e.g.,?tag=foo&tag=bar
) to lose all but the last value. Theappend
pattern on line 52 indicates the intent to collect all values, but the map iteration cannot provide them.Use
VisitAll()
to properly iterate all query parameters including duplicates:if cfg.IncludeQueryString { queryStringData := make(map[string][]string) - for key, value := range c.Request().URI().QueryArgs().All() { - k := utils.UnsafeString(key) - queryStringData[k] = append(queryStringData[k], utils.UnsafeString(value)) - } + c.Request().URI().QueryArgs().VisitAll(func(key, value []byte) { + k := utils.UnsafeString(key) + queryStringData[k] = append(queryStringData[k], utils.UnsafeString(value)) + }) input["query"] = queryStringData }
🧹 Nitpick comments (9)
v3/i18n/config.go (1)
119-121
: Remove duplicate defaulting of UnmarshalFunc.
cfg.UnmarshalFunc
is set twice; keep one to avoid drift.if cfg.UnmarshalFunc == nil { cfg.UnmarshalFunc = ConfigDefault.UnmarshalFunc } - - if cfg.UnmarshalFunc == nil { - cfg.UnmarshalFunc = ConfigDefault.UnmarshalFunc - }Also applies to: 135-137
v3/opa/fiber_test.go (1)
154-189
: Add test coverage for duplicate query parameters.The test suite validates single-value query parameters but doesn't cover the duplicate key scenario (e.g.,
?tag=foo&tag=bar
). Given the array structure expected by the Rego policy ({"testKey": ["testVal"]}
), adding a test with duplicate query parameters would verify correct handling of multiple values per key.Would you like me to generate a test case that validates duplicate query parameter handling?
v3/zap/logger_test.go (1)
44-53
: Prefer temp directories for test log files.Writing to ./all|debug|info|warn|error can pollute the repo and fail under restricted CI. Use t.TempDir() and create files under it.
Example:
-func getWriteSyncer(file string) zapcore.WriteSyncer { - _, err := os.Stat(file) - if os.IsNotExist(err) { - _ = os.MkdirAll(filepath.Dir(file), 0o744) - } - f, _ := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644) - return zapcore.AddSync(f) -} +func getWriteSyncer(t *testing.T, rel string) zapcore.WriteSyncer { + t.Helper() + dir := t.TempDir() + file := filepath.Join(dir, rel) + _ = os.MkdirAll(filepath.Dir(file), 0o744) + f, _ := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644) + return zapcore.AddSync(f) +}And update call sites to pass t.
v3/i18n/i18n.go (2)
125-137
: Handle unsupported param types explicitly to avoid nil LocalizeConfig.If params isn’t string or *i18n.LocalizeConfig, you pass nil to Localize, leading to unclear errors.
Apply this diff:
switch paramValue := params.(type) { case string: localizeConfig = &i18n.LocalizeConfig{MessageID: paramValue} case *i18n.LocalizeConfig: localizeConfig = paramValue +default: + return "", fmt.Errorf("i18n.Localize error: unsupported param type %T", params) } -message, err := localizer.(*i18n.Localizer).Localize(localizeConfig) +loc, ok := localizer.(*i18n.Localizer) +if !ok { + return "", fmt.Errorf("i18n.Localize error: invalid localizer type %T", localizer) +} +message, err := loc.Localize(localizeConfig)
36-44
: Avoid panics on load; prefer error propagation or a configurable fail mode.Panicking on file read/parse errors makes applications crash at startup. Consider returning an error from New(...) or adding a Config flag (e.g., FailOnLoadError) to log and continue.
Would you like a follow-up diff to introduce a non-panicking path while keeping backward behavior by default?
v3/zap/zap_test.go (1)
1-1
: Package rename acknowledged; consider aliasing Uber zap import to reduce ambiguity.Current package is zap and you import go.uber.org/zap as zap; optional alias (e.g., uzap) can reduce confusion in tests.
Example:
- "go.uber.org/zap" + uzap "go.uber.org/zap"Then update types/usages accordingly (uzap.Logger, uzap.New, etc.).
v3/zap/zap.go (1)
167-169
: Prefer request ID from request, fall back to response.If you intend to log the inbound request ID, try request header first.
- fields = append(fields, zap.String("requestId", c.GetRespHeader(fiber.HeaderXRequestID))) + rid := c.Get(fiber.HeaderXRequestID) + if rid == "" { + rid = c.GetRespHeader(fiber.HeaderXRequestID) + } + fields = append(fields, zap.String("requestId", rid))v3/otel/fiber.go (1)
152-154
: SSE content-type equality check is too strict.Responses often include parameters (e.g., “text/event-stream; charset=utf-8”). Use a prefix match.
- if c.GetRespHeader("Content-Type") != "text/event-stream" { + if !strings.HasPrefix(c.GetRespHeader("Content-Type"), "text/event-stream") { responseSize = int64(len(c.Response().Body())) }Add the import if not present:
import ( "context" "net/http" "time" + "strings"
v3/i18n/README.md (1)
26-31
: Signature row naming could confuse readers.You use i18n.Config (package-qualified) here, while the example uses contribi18n.Config. Since this README is for the i18n package itself, drop the qualifier for clarity.
-| New | `New(config ...*i18n.Config) fiber.Handler` | Create a new i18n middleware handler | +| New | `New(config ...*Config) fiber.Handler` | Create a new i18n middleware handler |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (32)
.github/workflows/test-fibernewrelic.yml
is excluded by!**/*.yml
.github/workflows/test-fibersentry.yml
is excluded by!**/*.yml
.github/workflows/test-fiberzerolog.yml
is excluded by!**/*.yml
.github/workflows/test-i18n.yml
is excluded by!**/*.yml
.github/workflows/test-newrelic.yml
is excluded by!**/*.yml
.github/workflows/test-opa.yml
is excluded by!**/*.yml
.github/workflows/test-otel.yml
is excluded by!**/*.yml
.github/workflows/test-sentry.yml
is excluded by!**/*.yml
.github/workflows/test-zap.yml
is excluded by!**/*.yml
.github/workflows/test-zerolog.yml
is excluded by!**/*.yml
go.work
is excluded by!**/*.work
,!**/*.work
v3/i18n/example/localize/en.yaml
is excluded by!**/*.yaml
v3/i18n/example/localize/zh.yaml
is excluded by!**/*.yaml
v3/i18n/example/localizeJSON/en.json
is excluded by!**/*.json
v3/i18n/example/localizeJSON/zh.json
is excluded by!**/*.json
v3/i18n/go.mod
is excluded by!**/*.mod
v3/i18n/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/newrelic/go.mod
is excluded by!**/*.mod
v3/newrelic/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/opa/go.mod
is excluded by!**/*.mod
v3/opa/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/otel/example/docker-compose.yml
is excluded by!**/*.yml
v3/otel/example/go.mod
is excluded by!**/*.mod
v3/otel/example/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/otel/go.mod
is excluded by!**/*.mod
v3/otel/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/sentry/go.mod
is excluded by!**/*.mod
v3/sentry/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/zap/go.mod
is excluded by!**/*.mod
v3/zap/go.sum
is excluded by!**/*.sum
,!**/*.sum
v3/zerolog/go.mod
is excluded by!**/*.mod
v3/zerolog/go.sum
is excluded by!**/*.sum
,!**/*.sum
📒 Files selected for processing (36)
README.md
(1 hunks)v3/i18n/README.md
(1 hunks)v3/i18n/config.go
(1 hunks)v3/i18n/embed.go
(1 hunks)v3/i18n/embed_test.go
(1 hunks)v3/i18n/example/main.go
(1 hunks)v3/i18n/i18n.go
(2 hunks)v3/i18n/i18n_test.go
(1 hunks)v3/newrelic/README.md
(1 hunks)v3/newrelic/fiber.go
(2 hunks)v3/newrelic/fiber_test.go
(5 hunks)v3/opa/README.md
(3 hunks)v3/opa/fiber.go
(2 hunks)v3/opa/fiber_test.go
(1 hunks)v3/otel/README.md
(1 hunks)v3/otel/config.go
(1 hunks)v3/otel/doc.go
(1 hunks)v3/otel/example/README.md
(1 hunks)v3/otel/example/server.go
(3 hunks)v3/otel/fiber.go
(5 hunks)v3/otel/otel_test/fiber_test.go
(24 hunks)v3/otel/semconv.go
(4 hunks)v3/sentry/README.md
(1 hunks)v3/sentry/config.go
(1 hunks)v3/sentry/sentry.go
(1 hunks)v3/sentry/sentry_test.go
(1 hunks)v3/zap/README.md
(5 hunks)v3/zap/config.go
(1 hunks)v3/zap/logger.go
(1 hunks)v3/zap/logger_test.go
(3 hunks)v3/zap/zap.go
(2 hunks)v3/zap/zap_test.go
(3 hunks)v3/zerolog/README.md
(1 hunks)v3/zerolog/config.go
(2 hunks)v3/zerolog/zerolog.go
(1 hunks)v3/zerolog/zerolog_test.go
(2 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#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
PR: gofiber/fiber#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:
v3/opa/fiber_test.go
v3/zap/zap_test.go
v3/newrelic/fiber_test.go
v3/otel/otel_test/fiber_test.go
📚 Learning: 2024-07-03T11:59:00.303Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Applied to files:
v3/i18n/embed.go
v3/i18n/i18n_test.go
v3/i18n/embed_test.go
v3/i18n/i18n.go
v3/i18n/README.md
v3/i18n/example/main.go
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
PR: gofiber/fiber#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:
v3/newrelic/fiber.go
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
PR: gofiber/fiber#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:
v3/zap/README.md
v3/otel/otel_test/fiber_test.go
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
v3/zap/README.md
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
PR: gofiber/fiber#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:
v3/otel/otel_test/fiber_test.go
📚 Learning: 2024-10-02T23:03:31.727Z
Learnt from: sixcolors
PR: gofiber/fiber#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:
v3/otel/otel_test/fiber_test.go
📚 Learning: 2024-07-26T21:00:12.902Z
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Applied to files:
v3/otel/otel_test/fiber_test.go
🧬 Code graph analysis (3)
v3/otel/example/server.go (1)
v3/otel/fiber.go (1)
Middleware
(37-185)
v3/otel/otel_test/fiber_test.go (3)
v3/otel/fiber.go (7)
Middleware
(37-185)MetricNameHttpServerDuration
(25-25)MetricNameHttpServerRequestSize
(26-26)UnitBytes
(32-32)MetricNameHttpServerResponseSize
(27-27)MetricNameHttpServerActiveRequests
(28-28)UnitDimensionless
(31-31)v3/otel/config.go (9)
WithTracerProvider
(55-59)WithNext
(38-42)WithPropagators
(47-51)WithMeterProvider
(63-67)WithPort
(80-84)WithCustomAttributes
(88-92)WithCustomMetricAttributes
(96-100)WithCollectClientIP
(104-108)WithoutMetrics
(111-115)v3/otel/semconv.go (1)
HasBasicAuth
(96-124)
v3/i18n/example/main.go (2)
v3/i18n/i18n.go (3)
New
(17-34)Localize
(106-139)MustLocalize
(85-91)v3/i18n/config.go (1)
Config
(14-58)
🪛 LanguageTool
v3/zap/README.md
[grammar] ~37-~37: Ensure spelling is correct
Context: ...[]string
| Add fields what you want see. ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
v3/otel/README.md
[style] ~12-~12: To form a complete sentence, be sure to include a subject.
Context: .../opentelemetry.io/) support for Fiber. Can be found on [OpenTelemetry Registry](ht...
(MISSING_IT_THERE)
🪛 markdownlint-cli2 (0.18.1)
v3/sentry/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
41-41: Bare URL used
(MD034, no-bare-urls)
README.md
20-20: Images should have alternate text (alt text)
(MD045, no-alt-text)
21-21: Images should have alternate text (alt text)
(MD045, no-alt-text)
22-22: Images should have alternate text (alt text)
(MD045, no-alt-text)
23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
24-24: Images should have alternate text (alt text)
(MD045, no-alt-text)
25-25: Images should have alternate text (alt text)
(MD045, no-alt-text)
26-26: Images should have alternate text (alt text)
(MD045, no-alt-text)
27-27: Images should have alternate text (alt text)
(MD045, no-alt-text)
28-28: Images should have alternate text (alt text)
(MD045, no-alt-text)
29-29: Images should have alternate text (alt text)
(MD045, no-alt-text)
30-30: Images should have alternate text (alt text)
(MD045, no-alt-text)
31-31: Images should have alternate text (alt text)
(MD045, no-alt-text)
32-32: Images should have alternate text (alt text)
(MD045, no-alt-text)
33-33: Images should have alternate text (alt text)
(MD045, no-alt-text)
34-34: Images should have alternate text (alt text)
(MD045, no-alt-text)
35-35: Images should have alternate text (alt text)
(MD045, no-alt-text)
36-36: Images should have alternate text (alt text)
(MD045, no-alt-text)
37-37: Images should have alternate text (alt text)
(MD045, no-alt-text)
41-41: Images should have alternate text (alt text)
(MD045, no-alt-text)
v3/i18n/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/zap/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/zerolog/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/newrelic/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/otel/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (20)
v3/otel/config.go (1)
1-1
: Package rename to otel looks good.No behavioral changes; API surface remains intact.
v3/zap/config.go (1)
1-1
: Package rename to zap is fine.No functional changes; defaults preserved.
v3/newrelic/fiber.go (1)
118-120
: FromContext uses the v3 Go context correctly.
newrelic.FromContext(c.Context())
matches the v3 rename (RequestCtx()
for fasthttp,Context()
for Go context).Based on learnings
v3/zap/logger.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.The package rename from
fiberzap
tozap
is consistent with the broader v3 migration effort to simplify package names.v3/i18n/embed_test.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.The package rename from
fiberi18n
toi18n
follows the v3 migration pattern of removing the "fiber" prefix from package names.v3/otel/example/README.md (1)
2-2
: LGTM! Front matter ID updated consistently.The ID change from
otelfiber-example
tootel-example
aligns with the package naming changes in the v3 migration.v3/i18n/i18n_test.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.Consistent package rename from
fiberi18n
toi18n
as part of the v3 migration.v3/sentry/config.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.The package rename from
fibersentry
tosentry
is consistent with the v3 migration pattern.v3/sentry/sentry.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.The package rename from
fibersentry
tosentry
is consistent with the v3 migration effort.v3/zerolog/zerolog.go (1)
1-1
: LGTM! Package rename aligns with v3 migration.The package rename from
fiberzerolog
tozerolog
follows the v3 migration pattern of simplifying package names.v3/sentry/sentry_test.go (1)
1-1
: Package rename alignment looks good.Matches the v3 module path and related package changes.
v3/zerolog/zerolog_test.go (2)
1-1
: Package rename alignment looks good.Consistent with v3 module path.
220-221
: Updated protocol expectation is correct.Fiber’s test client defaults to HTTP/1.1; expectation "HTTP/1.1" is appropriate.
v3/i18n/embed.go (1)
3-3
: Package rename alignment looks good.Embed loader remains simple and correct.
v3/zap/logger_test.go (2)
1-1
: Package rename alignment looks good.Consistent with v3 path and API surface.
235-235
: Generic SetLogger usage looks correct.Type parameter aligns with updated API and improves type safety.
v3/i18n/i18n.go (1)
14-14
: localsKey rename is fine.Matches the v3 package rename and avoids old “fiberi18n” namespace. Based on learnings.
v3/zap/zap_test.go (1)
150-156
: Expected values updated for Fiber v3 defaults — looks correct."protocol" -> "HTTP/1.1", "resBody" -> "Not Found", "bytesSent" -> 9 match Fiber v3 test behavior. Same for Test_Fields_Func protocol.
Also applies to: 475-475
v3/i18n/example/main.go (1)
6-9
: I18n example updates look good.Aliases and API usage align with v3 i18n middleware and go‑i18n v2 types.
Also applies to: 15-20, 22-27, 29-35
v3/otel/doc.go (1)
1-1
: Package doc/import path rename is correct.Matches the v3 module path and package name consolidation.
Also applies to: 6-6
for header, values := range c.GetReqHeaders() { | ||
if len(values) == 0 { | ||
continue | ||
} | ||
|
||
if len(values) == 1 { | ||
fields = append(fields, zap.String(header, values[0])) | ||
continue | ||
} | ||
|
||
fields = append(fields, zap.Strings(header, values)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request header logging may leak secrets (Authorization, Cookie, API keys). Add redaction.
Emitting all headers verbatim is a compliance/PII risk. Redact common sensitive headers by default.
- for header, values := range c.GetReqHeaders() {
+ for header, values := range c.GetReqHeaders() {
+ if shouldRedactHeader(header) {
+ values = []string{"[REDACTED]"}
+ }
if len(values) == 0 {
continue
}
if len(values) == 1 {
fields = append(fields, zap.String(header, values[0]))
continue
}
fields = append(fields, zap.Strings(header, values))
}
Add this helper and import:
import (
"os"
"strconv"
"sync"
"time"
+ "strings"
@@
func contains(needle string, slice []string) bool {
@@
}
+
+// shouldRedactHeader returns true for headers commonly containing secrets/PII.
+func shouldRedactHeader(h string) bool {
+ switch strings.ToLower(h) {
+ case "authorization", "proxy-authorization", "cookie", "set-cookie",
+ "x-api-key", "x-apikey", "api-key", "x-auth-token":
+ return true
+ default:
+ return false
+ }
+}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
for header, values := range c.GetReqHeaders() { | |
if len(values) == 0 { | |
continue | |
} | |
if len(values) == 1 { | |
fields = append(fields, zap.String(header, values[0])) | |
continue | |
} | |
fields = append(fields, zap.Strings(header, values)) | |
} | |
for header, values := range c.GetReqHeaders() { | |
if shouldRedactHeader(header) { | |
values = []string{"[REDACTED]"} | |
} | |
if len(values) == 0 { | |
continue | |
} | |
if len(values) == 1 { | |
fields = append(fields, zap.String(header, values[0])) | |
continue | |
} | |
fields = append(fields, zap.Strings(header, values)) | |
} |
🤖 Prompt for AI Agents
In v3/zap/zap.go around lines 174-185, the request header logging loop currently
emits all headers verbatim which may leak sensitive values; add a
case-insensitive helper function (e.g., isSensitiveHeader(name string) bool)
that matches common sensitive header names (Authorization, Cookie, Set-Cookie,
Proxy-Authorization, X-Api-Key, Api-Key, X-Csrf-Token, X-Auth-Token, etc.),
import strings for case-insensitive comparisons, and when a header is sensitive
replace its value(s) with a redaction token like "[REDACTED]" (for single value
use zap.String(header, "[REDACTED]"), for multiple values use
zap.Strings(header, []string{"[REDACTED]"})) instead of logging the real values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ReneWerner87 I agree, we should add a "DisbleRedact" option in the config to hide keys/secrets from being logged.
Same probably applies to zerolog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
v3/zap/zap.go (1)
50-62
: Remove dead code and fix error field handling to avoid nil/duplicate logging.
- errPadding and the stack scan are unused. Drop them to save work on first request.
- zap.Error(err) always logs nil (err is the named return, not chainErr) and bypasses cfg.Fields. Log errors only when requested via the "error" field, using zap.Error(chainErr).
@@ - var errPadding = 15 var latencyEnabled = contains("latency", cfg.Fields) @@ - once.Do(func() { - // get longested possible path - stack := c.App().Stack() - for m := range stack { - for r := range stack[m] { - if len(stack[m][r].Path) > errPadding { - errPadding = len(stack[m][r].Path) - } - } - } - // override error handler - errHandler = c.App().Config().ErrorHandler - }) + once.Do(func() { + // capture app error handler once + errHandler = c.App().Config().ErrorHandler + }) @@ - fields := make([]zap.Field, 0, len(cfg.Fields)+1) - fields = append(fields, zap.Error(err)) + fields := make([]zap.Field, 0, len(cfg.Fields)) @@ - case "error": - if chainErr != nil { - fields = append(fields, zap.String("error", chainErr.Error())) - } + case "error": + if chainErr != nil { + fields = append(fields, zap.Error(chainErr)) + }Also applies to: 112-119, 171-174
🧹 Nitpick comments (6)
v3/sentry/README.md (2)
41-41
: Avoid bare URL; link the Hub type via pkg.go.dev (MD034).-`sentry` attaches an instance of `*sentry.Hub` (https://godoc.org/github.com/getsentry/sentry-go#Hub) to the request's context, which makes it available throughout the rest of the request's lifetime. +`sentry` attaches an instance of [*sentry.Hub](https://pkg.go.dev/github.com/getsentry/sentry-go#Hub) to the request's context, which makes it available throughout the rest of the request's lifetime.
13-15
: Replace emphasized note with a heading to satisfy MD036.-**Note: Requires Go 1.25 and above** +### Requirements + +Requires Go 1.25 and above.v3/zap/README.md (2)
13-14
: Use a heading instead of emphasized text (MD036).-**Note: Requires Go 1.25 and above** +### Requirements + +Requires Go 1.25 and above.
35-35
: Tighten phrasing in Config descriptions.-| Next | `func(fiber.Ctx) bool` | Define a function to skip this middleware when returned true | `nil` | +| Next | `func(fiber.Ctx) bool` | Define a function to skip this middleware when it returns true | `nil` | @@ -| GetResBody | `func(c fiber.Ctx) []byte` | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. | `nil` | +| GetResBody | `func(c fiber.Ctx) []byte` | Return a readable response body when non-nil.<br/>e.g., when using the compress middleware, resBody is unreadable; set GetResBody to return a readable body. | `nil` |Also applies to: 42-42
v3/zap/logger_test.go (1)
186-189
: Make caller assertion path-agnostic.ShortCaller may emit just the base filename, and separators vary by OS. Relax the regex.
- assert.Regexp(t, regexp.MustCompile(`zap/logger_test.go:\d+`), caller) + assert.Regexp(t, regexp.MustCompile(`(^|[\\/])logger_test\.go:\d+$`), caller)v3/zap/zap.go (1)
208-214
: Broaden default header redaction set.Add common sensitive headers like Set-Cookie and CSRF/API-key variants.
var sensitiveRequestHeaders = map[string]struct{}{ "authorization": {}, "proxy-authorization": {}, "cookie": {}, - "x-api-key": {}, + "set-cookie": {}, + "x-api-key": {}, + "api-key": {}, + "x-csrf-token": {}, + "x-xsrf-token": {}, "x-auth-token": {}, }If you want this to be configurable, consider a follow-up option like RedactHeaders []string or DisableRedact bool in Config. I can open an issue with a proposal.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
README.md
(1 hunks)v3/otel/README.md
(1 hunks)v3/sentry/README.md
(1 hunks)v3/zap/README.md
(5 hunks)v3/zap/logger_test.go
(3 hunks)v3/zap/zap.go
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- v3/otel/README.md
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#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: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
PR: gofiber/fiber#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:
v3/zap/README.md
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
v3/zap/README.md
🪛 markdownlint-cli2 (0.18.1)
v3/zap/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
v3/sentry/README.md
13-13: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
41-41: Bare URL used
(MD034, no-bare-urls)
🔇 Additional comments (1)
README.md (1)
20-37
: LGTM: badges have alt text and v3 paths look correct.If convenient, run markdownlint to confirm MD045/MD034/MD036 are green.
Also applies to: 41-41
sdk "github.com/getsentry/sentry-go" | ||
fiberSentry "github.com/gofiber/contrib/v3/sentry" | ||
"github.com/gofiber/fiber/v3" | ||
"github.com/gofiber/fiber/v3/utils" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix compile error in example: remove utils.ImmutableString and unused import.
c.Hostname() returns string; utils.ImmutableString expects []byte. Replace the call and drop the utils import.
import (
"fmt"
"log"
sdk "github.com/getsentry/sentry-go"
fiberSentry "github.com/gofiber/contrib/v3/sentry"
"github.com/gofiber/fiber/v3"
- "github.com/gofiber/fiber/v3/utils"
)
@@
- fmt.Println(utils.ImmutableString(c.Hostname()))
+ fmt.Println(c.Hostname())
Also applies to: 67-67
🤖 Prompt for AI Agents
In v3/sentry/README.md around lines 54-58 (and also apply the same change at
line 67), the example imports "github.com/gofiber/fiber/v3/utils" and calls
utils.ImmutableString(c.Hostname()), which causes a compile error because
c.Hostname() already returns a string and utils.ImmutableString expects a
[]byte; remove the unused utils import and replace
utils.ImmutableString(c.Hostname()) with c.Hostname() at the specified locations
so the example compiles.
Replaces #1427
Summary
/v1
suffix while keeping the existing release formattingTesting
https://chatgpt.com/codex/tasks/task_e_68e914980bf88326a2941b9c4b320585
Summary by CodeRabbit
Release Notes
New Features
Updates
Bug Fixes
Documentation