🧹 chore: remove unneeded "utils" alias#3834
Conversation
Signed-off-by: Artur Melanchyk <13834276+arturmelanchyk@users.noreply.github.com>
WalkthroughStandardizes imports by removing explicit Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant Storage
participant Context
Note over Caller,Storage: GetWithContext / SetWithContext / DeleteWithContext flow (refactored)
Caller->>Storage: Call GetWithContext(key, ctx)
Storage->>Context: check ctx.Done() via wrapContextError(ctx, "Get")
alt ctx done
Context-->>Storage: context error
Storage-->>Caller: return wrapContextError result (operation-specific error)
else not done
Storage-->>Storage: perform map lookup using map[string]Entry
Storage-->>Caller: return value / nil
end
sequenceDiagram
autonumber
participant TestRunner
participant TLSUtil
Note over TestRunner,TLSUtil: GetTLSConfigs() new flow with explicit error checks
TestRunner->>TLSUtil: GetTLSConfigs()
TLSUtil->>TLSUtil: generate CA key & cert (check errors)
TLSUtil->>TLSUtil: encode PEM (check errors)
TLSUtil->>TLSUtil: generate server key & cert (check errors)
TLSUtil->>TLSUtil: create tls.Config(s), set MinVersion=TLS1.2
TLSUtil->>TLSUtil: append CA to client RootCAs (check success)
TLSUtil-->>TestRunner: return serverConfig, clientConfig, nil or wrapped error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.go📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (7)📓 Common learnings📚 Learning: 2024-12-13T08:14:22.851ZApplied to files:
📚 Learning: 2024-07-26T21:00:12.902ZApplied to files:
📚 Learning: 2025-10-16T07:19:52.418ZApplied to files:
📚 Learning: 2024-10-02T23:03:31.727ZApplied to files:
📚 Learning: 2025-10-22T13:48:12.485ZApplied to files:
📚 Learning: 2024-10-08T19:06:06.583ZApplied to files:
🧬 Code graph analysis (1)internal/storage/memory/memory.go (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (4)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3834 +/- ##
==========================================
- Coverage 92.26% 92.19% -0.07%
==========================================
Files 115 115
Lines 9745 9742 -3
==========================================
- Hits 8991 8982 -9
- Misses 480 485 +5
- Partials 274 275 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/memory/memory.go (1)
9-9: Memory store: import cleanup — OK; minor ergonomics noteLGTM. Since New() calls utils.StartTimeStampUpdater(), ensure it’s globally idempotent to avoid redundant goroutines when multiple stores are created; otherwise centralize call at app bootstrap.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (60)
app.go(1 hunks)app_test.go(1 hunks)bind.go(1 hunks)binder/cbor.go(1 hunks)binder/cookie.go(1 hunks)binder/form.go(1 hunks)binder/header.go(1 hunks)binder/json.go(1 hunks)binder/mapping.go(1 hunks)binder/msgpack.go(1 hunks)binder/resp_header.go(1 hunks)binder/xml.go(1 hunks)client/client.go(1 hunks)client/client_test.go(1 hunks)client/cookiejar.go(1 hunks)client/hooks.go(1 hunks)client/request.go(1 hunks)client/response.go(1 hunks)ctx.go(1 hunks)ctx_test.go(1 hunks)extractors/extractors.go(1 hunks)helpers.go(1 hunks)helpers_test.go(1 hunks)internal/memory/memory.go(1 hunks)internal/memory/memory_test.go(1 hunks)internal/storage/memory/memory.go(3 hunks)listen_test.go(1 hunks)log/default.go(1 hunks)middleware/adaptor/adaptor.go(1 hunks)middleware/basicauth/basicauth.go(1 hunks)middleware/cache/cache.go(1 hunks)middleware/cache/cache_test.go(1 hunks)middleware/cache/config.go(1 hunks)middleware/cache/manager_test.go(1 hunks)middleware/cors/cors.go(1 hunks)middleware/csrf/config.go(1 hunks)middleware/csrf/csrf.go(1 hunks)middleware/csrf/csrf_test.go(1 hunks)middleware/csrf/storage_manager.go(1 hunks)middleware/idempotency/idempotency.go(1 hunks)middleware/keyauth/keyauth.go(1 hunks)middleware/limiter/limiter_fixed.go(1 hunks)middleware/limiter/limiter_sliding.go(1 hunks)middleware/logger/default_logger.go(1 hunks)middleware/logger/template_chain.go(1 hunks)middleware/logger/utils.go(1 hunks)middleware/pprof/pprof.go(1 hunks)middleware/proxy/proxy.go(1 hunks)middleware/requestid/config.go(1 hunks)middleware/session/config.go(1 hunks)middleware/session/session.go(1 hunks)middleware/static/static.go(1 hunks)mount.go(1 hunks)path.go(1 hunks)redirect.go(1 hunks)register.go(1 hunks)req.go(2 hunks)res.go(1 hunks)router.go(1 hunks)router_test.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Apply formatting using gofumpt (Make target: format)
Optimize struct field alignment using betteralign (Make target: betteralign)
Modernize code using gopls modernize (Make target: modernize)
Files:
ctx.gorouter_test.goapp.gobinder/header.goreq.gomiddleware/keyauth/keyauth.goextractors/extractors.golisten_test.gobinder/xml.gobinder/mapping.goctx_test.gomiddleware/limiter/limiter_sliding.gomiddleware/csrf/csrf_test.gomount.gomiddleware/basicauth/basicauth.gomiddleware/csrf/csrf.gomiddleware/pprof/pprof.goclient/request.gointernal/memory/memory.goclient/client_test.goapp_test.gores.golog/default.gomiddleware/cache/manager_test.gomiddleware/cache/cache.gomiddleware/limiter/limiter_fixed.gomiddleware/cors/cors.gobinder/cookie.gomiddleware/logger/utils.gomiddleware/cache/cache_test.gorouter.goredirect.goclient/cookiejar.gohelpers.gobinder/form.gomiddleware/logger/template_chain.gomiddleware/logger/default_logger.gobinder/msgpack.gopath.gomiddleware/static/static.goclient/client.gomiddleware/requestid/config.gobinder/resp_header.gobind.gomiddleware/proxy/proxy.gointernal/memory/memory_test.goclient/response.gomiddleware/csrf/config.gomiddleware/idempotency/idempotency.gomiddleware/session/session.gobinder/json.goregister.gomiddleware/adaptor/adaptor.gomiddleware/csrf/storage_manager.gomiddleware/session/config.gomiddleware/cache/config.gohelpers_test.goclient/hooks.gointernal/storage/memory/memory.gobinder/cbor.go
🧠 Learnings (14)
📚 Learning: 2025-09-28T17:39:26.644Z
Learnt from: arturmelanchyk
Repo: gofiber/fiber PR: 3768
File: client/request.go:162-166
Timestamp: 2025-09-28T17:39:26.644Z
Learning: In fasthttp-based code like gofiber, using utils.UnsafeString(key) instead of string(key) is acceptable when values are used immediately within the same call stack and not stored for later use, as it avoids allocations and aligns with fasthttp's zero-allocation design philosophy.
Applied to files:
ctx.gorouter_test.goapp.gobinder/header.goreq.gomiddleware/keyauth/keyauth.golisten_test.gobinder/mapping.gomiddleware/basicauth/basicauth.gomiddleware/pprof/pprof.goclient/request.goapp_test.gores.golog/default.gomiddleware/cache/cache.gomiddleware/cors/cors.gobinder/cookie.gomiddleware/cache/cache_test.gorouter.goredirect.goclient/cookiejar.gohelpers.gomiddleware/logger/default_logger.gopath.gomiddleware/static/static.goclient/client.gobinder/resp_header.gomiddleware/proxy/proxy.goclient/response.gomiddleware/idempotency/idempotency.gomiddleware/session/session.gomiddleware/adaptor/adaptor.gohelpers_test.goclient/hooks.go
📚 Learning: 2025-10-16T07:19:52.418Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:19:52.418Z
Learning: In the Fiber codebase, the linter does not allow `require` assertions from within HTTP handlers (including net/http-style handlers). Use `t.Fatalf`, `t.Errorf`, or similar `testing.T` methods for error handling inside handler functions instead.
Applied to files:
ctx.gorouter_test.goapp.gobinder/header.goreq.golisten_test.goctx_test.gomiddleware/csrf/csrf_test.gomiddleware/csrf/csrf.gomiddleware/pprof/pprof.goclient/request.goclient/client_test.goapp_test.gores.gomiddleware/cache/manager_test.gomiddleware/cache/cache.gomiddleware/cors/cors.gobinder/cookie.gomiddleware/cache/cache_test.gorouter.goclient/cookiejar.gohelpers.gomiddleware/logger/default_logger.gomiddleware/static/static.goclient/client.gobinder/resp_header.gomiddleware/proxy/proxy.gointernal/memory/memory_test.goclient/response.gomiddleware/session/session.gomiddleware/adaptor/adaptor.gohelpers_test.goclient/hooks.go
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
Repo: gofiber/fiber PR: 3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
Applied to files:
router_test.goapp.golisten_test.goctx_test.gomiddleware/csrf/csrf_test.gomount.gomiddleware/csrf/csrf.goclient/client_test.goapp_test.gorouter.goredirect.gobinder/form.gopath.gobind.gomiddleware/proxy/proxy.gomiddleware/idempotency/idempotency.gomiddleware/adaptor/adaptor.gohelpers_test.go
📚 Learning: 2024-07-26T21:00:12.902Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 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:
router_test.golisten_test.goctx_test.gomiddleware/csrf/csrf_test.goclient/client_test.goapp_test.gores.gomiddleware/cache/manager_test.gomiddleware/cache/cache_test.gointernal/memory/memory_test.gohelpers_test.go
📚 Learning: 2024-10-02T23:03:31.727Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Applied to files:
router_test.golisten_test.goctx_test.gomiddleware/csrf/csrf_test.goclient/client_test.goapp_test.gomiddleware/cache/manager_test.gomiddleware/cache/cache_test.gointernal/memory/memory_test.gohelpers_test.go
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Applied to files:
router_test.golisten_test.goclient/client_test.goapp_test.gomiddleware/cache/manager_test.gointernal/memory/memory_test.gohelpers_test.go
📚 Learning: 2025-10-16T07:15:26.529Z
Learnt from: grivera64
Repo: gofiber/fiber PR: 3807
File: adapter_test.go:118-144
Timestamp: 2025-10-16T07:15:26.529Z
Learning: In Fiber v3, net/http handlers (http.Handler, http.HandlerFunc, or raw func(http.ResponseWriter, *http.Request)) can be passed directly to routing methods like app.Get(), app.Post(), etc. The framework automatically detects and wraps them internally via toFiberHandler/collectHandlers. The github.com/gofiber/fiber/v3/middleware/adaptor package is legacy and should not be suggested for tests or code using native net/http handler support.
Applied to files:
app.gobinder/header.gomiddleware/csrf/csrf_test.gomiddleware/pprof/pprof.goclient/request.gomiddleware/cache/cache.gobinder/cookie.gomiddleware/cache/cache_test.gomiddleware/static/static.goclient/client.gomiddleware/requestid/config.gobinder/resp_header.gomiddleware/proxy/proxy.gomiddleware/session/session.gomiddleware/adaptor/adaptor.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Applied to files:
app.gobinder/header.gomiddleware/keyauth/keyauth.gomiddleware/pprof/pprof.goclient/request.gomiddleware/cache/cache.gobinder/cookie.gomiddleware/static/static.goclient/client.gobinder/resp_header.gomiddleware/proxy/proxy.gomiddleware/adaptor/adaptor.go
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
Repo: gofiber/fiber PR: 3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
Applied to files:
middleware/keyauth/keyauth.goctx_test.goclient/request.gopath.gomiddleware/proxy/proxy.go
📚 Learning: 2024-10-12T10:01:44.206Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/middleware_test.go:190-191
Timestamp: 2024-10-12T10:01:44.206Z
Learning: When testing session `IdleTimeout` expiration, it's acceptable to use `time.Sleep` to simulate the passage of time in tests.
Applied to files:
listen_test.goapp_test.gomiddleware/cache/manager_test.gointernal/memory/memory_test.gohelpers_test.go
📚 Learning: 2024-11-29T12:37:27.581Z
Learnt from: efectn
Repo: gofiber/fiber PR: 3162
File: app_test.go:893-895
Timestamp: 2024-11-29T12:37:27.581Z
Learning: In the `Test_App_ShutdownWithContext` function in `app_test.go`, the `clientDone` channel is used to synchronize the client's request completion before proceeding, eliminating the need for additional `time.Sleep` calls.
Applied to files:
listen_test.go
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/config.go:16-26
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the session middleware `Config` struct, `Store` is backed by `fiber.Storage`; they are different entities serving distinct purposes in session management.
Applied to files:
internal/memory/memory.gomiddleware/requestid/config.gomiddleware/session/config.gomiddleware/cache/config.gointernal/storage/memory/memory.go
📚 Learning: 2025-07-27T17:28:53.403Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3625
File: middleware/session/config.go:57-58
Timestamp: 2025-07-27T17:28:53.403Z
Learning: In the session middleware `Config` struct, the `Extractor` field uses function closures (like `FromCookie(key)`), making it impossible to introspect extractor parameters at runtime for validation purposes without complex reflection techniques.
Applied to files:
middleware/csrf/config.gomiddleware/session/config.go
📚 Learning: 2024-10-02T15:16:39.868Z
Learnt from: sixcolors
Repo: gofiber/fiber PR: 3016
File: middleware/session/session.go:272-293
Timestamp: 2024-10-02T15:16:39.868Z
Learning: In the `middleware/session/session.go` file, the `saveSession()` method returns either `nil` or an error, so additional error wrapping in the `Save()` method is unnecessary.
Applied to files:
middleware/session/session.go
🔇 Additional comments (61)
ctx_test.go (1)
33-33: Test import normalization — OKAlias removed; tests still use utils.* as expected.
middleware/limiter/limiter_fixed.go (1)
9-9: Limiter: import cleanup — OK; verify timestamp updater idempotenceImport alias removal looks good. Please confirm utils.StartTimeStampUpdater() is safe to call multiple times across middleware instances (guarded with sync.Once inside utils or here). If not, consider wrapping it.
middleware/cache/config.go (1)
8-8: Cache config import normalization — OKNo functional impact; default KeyGenerator continues using utils.CopyString.
listen_test.go (1)
19-19: Test import cleanup — OKAlias removal is consistent; usage of utils.UnsafeString remains valid in tests.
ctx.go (1)
18-18: Verified: No aliased imports remain in codebaseThe removal of the utils/v2 import alias from ctx.go (line 18) has been confirmed. Script output shows no leftover aliased imports across the repository, confirming the change is isolated and complete.
router_test.go (1)
21-21: LGTM! Import alias removal improves consistency.The explicit
utilsalias has been removed in favor of the default package name. Since the package ingithub.com/gofiber/utils/v2is namedutils, all existing references (e.g.,utils.StatusMessageon line 1476) remain valid without any functional changes.bind.go (1)
10-10: LGTM! Import standardization looks good.Removing the explicit import alias improves code consistency. The default package name
utilsfromgithub.com/gofiber/utils/v2ensures all existing references (e.g., lines 305-306:utils.ToLower,utils.UnsafeString) continue to work correctly.client/hooks.go (1)
16-16: LGTM! Clean import style improvement.The removal of the explicit
utilsalias aligns with Go's conventional import style. All usages (e.g.,utils.UnsafeStringon line 68,utils.CopyByteson line 118) remain valid with the default package name.middleware/cors/cors.go (1)
10-10: LGTM! Import cleanup improves consistency.Removing the unnecessary import alias follows Go's idiomatic import style. The usage of
utils.Trim(line 57) continues to work correctly with the default package name.binder/resp_header.go (1)
4-4: LGTM! Import standardization is correct.The import alias removal is consistent with the PR's goal of cleaning up import declarations. All
utils.UnsafeStringcalls (lines 23-24) remain valid with the default package name.middleware/proxy/proxy.go (1)
11-11: LGTM! Import cleanup looks good.Removing the explicit import alias improves consistency across the codebase. All utility function calls (e.g.,
utils.UnsafeStringon line 85,utils.CopyStringon lines 185/188) remain functional with the default package name.extractors/extractors.go (1)
33-33: LGTM! Import standardization is consistent.The removal of the explicit
utilsalias aligns with the PR's objective of improving code consistency. Theutils.EqualFoldcall (line 126) continues to work correctly with the default package name.client/client.go (1)
24-24: LGTM! Import cleanup improves maintainability.The removal of the explicit import alias is consistent with the codebase-wide refactoring. All utils type references (e.g.,
utils.JSONMarshal,utils.XMLMarshal) and function calls (e.g.,utils.UnsafeStringon line 379) remain valid with the default package name.middleware/csrf/storage_manager.go (1)
11-11: LGTM! Removes redundant import alias.The explicit
utilsalias is unnecessary since the package's default name is alreadyutils. This cleanup improves code consistency.binder/cbor.go (1)
4-4: LGTM! Removes redundant import alias.The explicit alias is unnecessary and this change aligns with Go idioms.
middleware/limiter/limiter_sliding.go (1)
10-10: LGTM! Removes redundant import alias.Consistent with the codebase-wide cleanup to remove unnecessary aliases.
log/default.go (1)
10-10: LGTM! Removes redundant import alias.This change maintains consistency with the rest of the PR's cleanup effort.
mount.go (1)
12-12: LGTM! Removes redundant import alias.The cleanup is correctly applied with no impact on functionality.
middleware/csrf/csrf.go (1)
13-13: LGTM! Removes redundant import alias.Consistent with the broader refactoring effort across the codebase.
middleware/basicauth/basicauth.go (1)
11-11: LGTM! Removes redundant import alias.The change correctly removes the unnecessary alias while preserving all usage sites.
middleware/requestid/config.go (1)
5-5: LGTM! Removes redundant import alias.This completes the consistent cleanup across all affected files in the PR.
middleware/pprof/pprof.go (1)
8-8: LGTM! Import alias removal improves code consistency.The explicit alias for
github.com/gofiber/utils/v2is unnecessary since the package's natural name isutils. This change simplifies the import declaration while maintaining all existing functionality.client/cookiejar.go (1)
12-12: LGTM! Import style improvement aligns with codebase consistency.Removing the redundant alias simplifies the import while preserving all
utils.*references throughout the file (e.g.,UnsafeString,TrimLeft,ToLower,CopyString).middleware/session/config.go (1)
9-9: LGTM! Clean import simplification.The default package name
utilsis sufficient, making the explicit alias unnecessary. Usage at line 95 (utils.UUIDv4) remains unchanged and valid.middleware/session/session.go (1)
13-13: LGTM! Import consistency improvement.Removing the alias aligns with the natural package name
utils, maintaining all existing functionality without changes.helpers_test.go (1)
14-14: LGTM! Test file import consistency.The import simplification maintains all test functionality while improving code consistency across the codebase.
middleware/keyauth/keyauth.go (1)
10-10: LGTM! Import declaration simplified.The change removes the redundant alias while preserving all functionality (e.g.,
utils.EqualFoldat line 70).middleware/adaptor/adaptor.go (1)
14-14: LGTM! Import style cleanup.Removing the explicit alias maintains all existing usage (
utils.StatusMessageat lines 213 and 221) while improving code consistency.redirect.go (1)
13-13: LGTM! Consistent import simplification.The alias removal aligns with the repository-wide cleanup while maintaining all existing functionality (e.g.,
utils.ToLower,utils.UnsafeString,utils.ParseVendorSpecificContentTypeat lines 145-146).middleware/logger/default_logger.go (1)
10-10: LGTM! Import alias cleanup.The removal of the explicit
utilsalias is correct sincegithub.com/gofiber/utils/v2defaults to package nameutils. This change improves consistency across the codebase with no functional impact.middleware/static/static.go (1)
16-16: LGTM! Import alias cleanup.Removing the explicit
utilsalias is correct and maintains consistency with the codebase-wide refactoring.binder/cookie.go (1)
4-4: LGTM! Import alias cleanup.The change is correct and aligns with the codebase-wide import standardization.
req.go (2)
11-11: LGTM! Import alias cleanup.The removal of the explicit
utilsalias is correct and part of the codebase-wide consistency improvement.
802-805: LGTM! Type refinement improves clarity.Using the concrete
RangeSettype instead of an anonymous struct provides better type safety and code clarity.binder/mapping.go (1)
12-12: LGTM! Import alias cleanup.The change correctly removes the unnecessary import alias while maintaining all functionality.
router.go (1)
13-13: LGTM! Import alias cleanup.The import change is correct and aligns with the codebase-wide standardization effort.
middleware/csrf/config.go (1)
12-12: LGTM! Import alias cleanup.The change correctly removes the explicit alias, maintaining consistency across the codebase.
middleware/csrf/csrf_test.go (1)
15-15: LGTM! Import alias cleanup.The import change is correct and maintains all test functionality while improving codebase consistency.
binder/msgpack.go (1)
4-4: LGTM! Import alias removal is correct.The explicit
utilsalias was redundant since the package's default name is alreadyutils. The code continues to referenceutils.MsgPackUnmarshalcorrectly.middleware/idempotency/idempotency.go (1)
9-9: LGTM! Import simplification is correct.Removing the redundant alias maintains the same package references (
utils.CopyString,utils.CopyBytes,utils.ToLower) used throughout the middleware.middleware/logger/utils.go (1)
8-8: LGTM! Alias removal is appropriate.The change correctly removes the redundant alias while preserving all
utils.UnsafeStringreferences in the custom logger writer.middleware/cache/manager_test.go (1)
8-8: LGTM! Test import updated correctly.The import simplification maintains compatibility with
utils.UUID()calls in the test cases.internal/memory/memory_test.go (1)
7-7: LGTM! Benchmark import cleaned up correctly.The alias removal is consistent with the codebase-wide refactoring and maintains
utils.UUID()usage in the benchmark.binder/form.go (1)
6-6: LGTM! Form binder import updated appropriately.The redundant alias removal preserves the zero-allocation
utils.UnsafeStringcalls used throughout the form binding logic.res.go (1)
17-17: LGTM! Response handler import simplified correctly.The alias removal is consistent across all utility function calls (
utils.EqualFold,utils.TrimRight,utils.ToString,utils.CopyString,utils.StatusMessage,utils.UnsafeBytes,utils.GetMIME) throughout this file.path.go (1)
18-18: LGTM! Route parser import cleaned up properly.The import simplification maintains all utility references (
utils.ToLowerBytes,utils.ToLower,utils.TrimRight,utils.EqualFold) used in the route parsing logic.middleware/logger/template_chain.go (1)
7-7: LGTM! Import alias removal is correct.The explicit
utilsalias is redundant since Go automatically uses the last path segment (utils) as the package name forgithub.com/gofiber/utils/v2. All references toutils.*throughout the file continue to work identically.binder/xml.go (1)
6-6: LGTM! Import alias removal is correct.The change removes the redundant explicit alias. The
utils.XMLUnmarshalreference at line 11 continues to work with the default package name.helpers.go (1)
24-24: LGTM! Import alias removal is correct.The explicit
utilsalias is redundant. All references throughout the file (UnsafeString, UnsafeBytes, EqualFold, Trim, TrimRight, ToLowerBytes) continue to work with the default package name.internal/storage/memory/memory.go (2)
10-10: LGTM! Import alias removal is correct.The change removes the redundant explicit alias. All
utils.*references throughout the file continue to work with the default package name.
60-61: Good addition: clarifying comments improve code documentation.The added comments at lines 60-61 and 90-94 helpfully document the defensive copying behavior, making the intent explicit for future maintainers.
Also applies to: 90-94
client/response.go (1)
14-14: LGTM! Import alias removal is correct.The explicit
utilsalias is redundant. All references (UnsafeString at lines 54, 66, 69, 72 and Trim at line 94) continue to work with the default package name.binder/header.go (1)
4-4: LGTM! Import alias removal is correct.The change removes the redundant explicit alias. The
utils.UnsafeStringcalls at lines 22-23 continue to work with the default package name.client/request.go (1)
19-19: LGTM! Import alias removal is correct.The explicit
utilsalias is redundant. Allutils.UnsafeStringreferences throughout the file continue to work with the default package name.client/client_test.go (1)
22-22: LGTM! Import alias removal is correct.The change removes the redundant explicit alias. All
utils.UnsafeStringcalls in the test assertions (lines 857, 888, 901, 929, 943) continue to work with the default package name.binder/json.go (1)
4-4: LGTM! Redundant alias removed.The import alias
utilswas unnecessary since the package's default name is alreadyutils. This change improves code consistency.register.go (1)
25-25: LGTM! Cleaner type assertion syntax.The parentheses around
Registerwere unnecessary. This change aligns with idiomatic Go style for compile-time interface assertions.middleware/cache/cache.go (1)
17-17: LGTM! Redundant alias removed.The import alias removal is consistent with the PR's objective. All usages of
utils.*identifiers throughout the file remain unchanged and correct.middleware/cache/cache_test.go (1)
21-21: LGTM! Test imports aligned with production code.The import change is consistent with the corresponding production file changes.
app_test.go (1)
30-30: LGTM! Import cleanup applied consistently.The redundant import alias has been removed, improving code consistency across the test suite.
app.go (1)
29-29: LGTM! Core file import standardized.The import alias removal is correctly applied. All references to
utils.*identifiers throughout the file (JSONMarshal, JSONUnmarshal, UnsafeBytes, UnsafeString, CopyBytes, StatusMessage, etc.) remain functional with the default package name.
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes import statements across the codebase by removing import aliases for the github.com/gofiber/utils/v2 package. It also includes a refactoring change in req.go to use the named RangeSet type instead of an anonymous struct, and fixes minor formatting issues.
Key Changes:
- Removed
utilsalias from all imports ofgithub.com/gofiber/utils/v2package - Replaced anonymous struct with the named
RangeSettype in theRangemethod - Fixed unnecessary parentheses in type assertion
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app.go, app_test.go | Removed utils import alias |
| bind.go | Removed utils import alias |
| binder/*.go | Removed utils import alias across all binder files |
| client/*.go | Removed utils import alias across all client files |
| ctx.go, ctx_test.go | Removed utils import alias |
| extractors/extractors.go | Removed utils import alias |
| helpers.go, helpers_test.go | Removed utils import alias |
| internal/memory/*.go, internal/storage/memory/memory.go | Removed utils import alias and fixed indentation |
| listen_test.go | Removed utils import alias |
| log/default.go | Removed utils import alias |
| middleware/*.go | Removed utils import alias across all middleware packages |
| mount.go, path.go, redirect.go | Removed utils import alias |
| register.go | Removed unnecessary parentheses in type assertion |
| req.go | Removed utils import alias and replaced anonymous struct with RangeSet type |
| res.go, router.go, router_test.go | Removed utils import alias |
|
@arturmelanchyk In this same PR, modify the |
Signed-off-by: Artur Melanchyk <13834276+arturmelanchyk@users.noreply.github.com>
|
We can add |
Signed-off-by: Artur Melanchyk <13834276+arturmelanchyk@users.noreply.github.com>
|
Ping @ReneWerner87 |
|
Will check it tomorrow morning |
|
/gemini review @codex review |
|
Thank you for invoking the review, @gaby. I've thoroughly reviewed the pull request, and it looks like a solid set of changes focused on code cleanliness and robustness. Overall, the primary goal of removing the unneeded I have one specific comment regarding the File: Comment:
If the intention is to exclude Severity: medium Let me know if you'd like me to elaborate on any of these points or if you have further questions! |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Description
This PR is simply cleaning the code, mostly removes unneeded
utilsaliasChanges introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md