-
Notifications
You must be signed in to change notification settings - Fork 56
update for fiber v3 #437
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: master
Are you sure you want to change the base?
update for fiber v3 #437
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR migrates README examples from Fiber v2→v3, centralizes binding normalization via a new AcquireViewContext(binding) using reflection, updates engine imports to the v2/v3 template packages, and refactors engines and tests to use the new helper instead of ad-hoc type switches. Changes
Sequence Diagram(s)sequenceDiagram
participant App as App (caller)
participant Engine as Template Engine
participant Acquire as AcquireViewContext
participant Reflect as reflect
rect rgba(232,245,233,0.6)
Note over App,Engine: Render flow now centralizes binding normalization
App->>Engine: Engine.Render(template, binding)
Engine->>Acquire: AcquireViewContext(binding)
end
alt binding == nil
Acquire-->>Engine: {}
else binding is map[string]interface{}
Acquire-->>Engine: same map
else pointer or map-like
Acquire->>Reflect: unwrap & iterate keys
Reflect-->>Acquire: validated map[string]interface{}
Acquire-->>Engine: populated map
else non-map
Acquire-->>Engine: {}
end
Engine->>Engine: render with normalized context
Engine-->>App: rendered output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request performs a significant update to the Fiber template engine repository, primarily to align it with the new Fiber v3 release and the latest Go language version (1.25). The changes encompass updating module paths, Go version requirements, and a crucial refactoring of the data binding mechanism to enhance flexibility and reduce tight coupling with specific Fiber data structures. These updates ensure that the template engines are fully compatible and optimized for the Fiber v3 ecosystem. Highlights
Ignored Files
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 updates the repository to use Fiber v3, which also involves a major version bump for the template library itself and its sub-packages. The changes include updating Go module paths, dependencies, and documentation. A significant and positive change is the refactoring to decouple template engines from fiber.Map by introducing a generic AcquireViewContext helper. I've found a few issues: the Go version is set to an unreleased version (1.25), there's an inconsistency in AcquireViewContext that could lead to side effects, and some minor formatting issues in the documentation. Overall, the changes are good, and with these fixes, the library will be in a much better state.
| module github.com/gofiber/template/ace/v3 | ||
|
|
||
| go 1.17 | ||
| go 1.25 |
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.
The go directive is set to 1.25, which is an unreleased version of Go. This will cause build failures for users on stable Go toolchains. The new code seems to require features from Go 1.22 (like reflect.MapRange), so the version should probably be 1.22. This change is needed in all go.mod files across the repository.
| go 1.25 | |
| go 1.22 |
README.md
Outdated
|
|
||
| ### Installation | ||
| > Go version `1.17` or higher is required. | ||
| > Go version `1.25` or higher is required. |
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.
The required Go version is set to 1.25, which has not been released yet. This will cause confusion and prevent users from using this library with current stable Go versions. The new code uses reflect.MapRange, which was introduced in Go 1.22. I suggest setting the minimum required version to 1.22.
| > Go version `1.25` or higher is required. | |
| > Go version `1.22` or higher is required. |
| "log" | ||
|
|
||
| "github.com/gofiber/fiber/v2" | ||
| "github.com/gofiber/fiber/v3" |
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.
The indentation for this import seems to be using spaces instead of a tab, which is inconsistent with the surrounding code and what gofmt would produce. This makes the code block harder to read. This formatting issue is also present in other code examples in this file (e.g., lines 141, 166, 191).
| "github.com/gofiber/fiber/v3" | |
| "github.com/gofiber/fiber/v3" |
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: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
django/django.go (1)
251-253: Compile fix: construct pongo2.Context, not map[string]interface{}.bind is pongo2.Context (a defined type). Assigning a plain map is a type mismatch.
- if bind == nil { - bind = make(map[string]interface{}, 1) - } + if bind == nil { + bind = make(pongo2.Context, 1) + }
🧹 Nitpick comments (7)
README.md (2)
52-61: Replace hard tabs in code blocks.markdownlint flags MD010; use spaces for alignment to keep linters green.
Also applies to: 142-143, 166-168, 191-193, 217-219
38-43: Add shell language label for syntax highlighting and confirm Go version requirement.Go 1.25 requirement is accurate per go.mod. Apply the suggested formatting change:
-``` +```sh go get -u github.com/gofiber/fiber/v3 go get -u github.com/gofiber/template/any_template_engine/vX</blockquote></details> <details> <summary>django/README.md (1)</summary><blockquote> `52-53`: **Remove tabs in import blocks.** MD010 warnings; switch to spaces for alignment. Also applies to: 108-110 </blockquote></details> <details> <summary>mustache/mustache.go (1)</summary><blockquote> `174-176`: **Nice simplification with AcquireViewContext.** Binding is normalized once, avoiding type switches. Consider preallocating capacity if desired: make(map[string]interface{}, len(bind)+1) when copying/augmenting elsewhere, but current code is fine. </blockquote></details> <details> <summary>template.go (2)</summary><blockquote> `136-139`: **Avoid mutating caller maps; copy when input is map[string]interface{}.** Returning the original map means downstream engines may add layout keys into the caller-provided map. Prefer copy-on-write to prevent side effects. Low cost vs. surprise bugs. ```diff - if binds, ok := binding.(map[string]interface{}); ok { - return binds - } + if binds, ok := binding.(map[string]interface{}); ok { + out := make(map[string]interface{}, len(binds)) + for k, v := range binds { + out[k] = v + } + return out + }
132-167: Add tests for edge cases.Please add unit tests covering: nil; empty map; pointer-to-map (nil and non-nil); user-defined map type with string keys; non-string key maps; pointer-to-pointer (ensure safe unwrap or fallback).
I can draft table-driven tests for AcquireViewContext if helpful.
django/django.go (1)
241-246: Don’t hold the engine lock across template execution.Locking around tmpl.Execute serializes all renders. Narrow the lock to only map lookups (e.Templates) and shared state reads. Execute outside the lock.
- // Lock while executing layout - e.Mutex.Lock() - defer e.Mutex.Unlock() - - bind := getPongoBinding(binding) - parsed, err := tmpl.Execute(bind) + bind := getPongoBinding(binding) + parsed, err := tmpl.Execute(bind) // execute without engine lock if err != nil { return err } ... - lay := e.Templates[layout[0]] + e.Mutex.RLock() + lay := e.Templates[layout[0]] + e.Mutex.RUnlock()Also applies to: 264-269
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (28)
.github/workflows/benchmark.ymlis excluded by!**/*.yml.github/workflows/golangci-lint.ymlis excluded by!**/*.yml.github/workflows/gosec.ymlis excluded by!**/*.yml.github/workflows/govulncheck.ymlis excluded by!**/*.yml.github/workflows/test-ace.ymlis excluded by!**/*.yml.github/workflows/test-amber.ymlis excluded by!**/*.yml.github/workflows/test-django.ymlis excluded by!**/*.yml.github/workflows/test-handlebars.ymlis excluded by!**/*.yml.github/workflows/test-html.ymlis excluded by!**/*.yml.github/workflows/test-jet.ymlis excluded by!**/*.yml.github/workflows/test-mustache.ymlis excluded by!**/*.yml.github/workflows/test-pug.ymlis excluded by!**/*.yml.github/workflows/test-slim.ymlis excluded by!**/*.ymlace/go.modis excluded by!**/*.modace/go.sumis excluded by!**/*.sum,!**/*.sumamber/go.modis excluded by!**/*.moddjango/go.modis excluded by!**/*.moddjango/go.sumis excluded by!**/*.sum,!**/*.sumgo.modis excluded by!**/*.modhandlebars/go.modis excluded by!**/*.modhandlebars/go.sumis excluded by!**/*.sum,!**/*.sumhtml/go.modis excluded by!**/*.modjet/go.modis excluded by!**/*.modjet/go.sumis excluded by!**/*.sum,!**/*.summustache/go.modis excluded by!**/*.modmustache/go.sumis excluded by!**/*.sum,!**/*.sumpug/go.modis excluded by!**/*.modslim/go.modis excluded by!**/*.mod
📒 Files selected for processing (23)
README.md(7 hunks)ace/README.md(1 hunks)ace/ace.go(1 hunks)amber/README.md(1 hunks)amber/amber.go(1 hunks)django/README.md(2 hunks)django/django.go(2 hunks)django/django_test.go(2 hunks)handlebars/README.md(1 hunks)handlebars/handlebars.go(2 hunks)handlebars/handlebars_test.go(6 hunks)html/README.md(3 hunks)html/html.go(1 hunks)jet/README.md(1 hunks)jet/jet.go(2 hunks)mustache/README.md(1 hunks)mustache/mustache.go(2 hunks)mustache/mustache_test.go(6 hunks)pug/README.md(1 hunks)pug/pug.go(1 hunks)slim/README.md(1 hunks)slim/slim.go(1 hunks)template.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
mustache/mustache.go (1)
template.go (1)
AcquireViewContext(136-167)
handlebars/handlebars.go (1)
template.go (1)
AcquireViewContext(136-167)
jet/jet.go (1)
template.go (1)
AcquireViewContext(136-167)
🪛 markdownlint-cli2 (0.18.1)
mustache/README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
pug/README.md
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
48-48: Hard tabs
Column: 1
(MD010, no-hard-tabs)
amber/README.md
46-46: Hard tabs
Column: 1
(MD010, no-hard-tabs)
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
ace/README.md
46-46: Hard tabs
Column: 1
(MD010, no-hard-tabs)
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
handlebars/README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
django/README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
README.md
40-40: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
54-54: Hard tabs
Column: 1
(MD010, no-hard-tabs)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
56-56: Hard tabs
Column: 1
(MD010, no-hard-tabs)
57-57: Hard tabs
Column: 1
(MD010, no-hard-tabs)
59-59: Hard tabs
Column: 1
(MD010, no-hard-tabs)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
142-142: Hard tabs
Column: 1
(MD010, no-hard-tabs)
167-167: Hard tabs
Column: 1
(MD010, no-hard-tabs)
192-192: Hard tabs
Column: 1
(MD010, no-hard-tabs)
217-217: Hard tabs
Column: 1
(MD010, no-hard-tabs)
218-218: Hard tabs
Column: 1
(MD010, no-hard-tabs)
⏰ 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). (1)
- GitHub Check: Compare
🔇 Additional comments (16)
pug/pug.go (1)
15-15: LGTM! Import path updated to v2.The core template import has been correctly updated to use the v2 module path, maintaining compatibility with the broader template package version upgrade.
html/html.go (1)
13-13: LGTM! Import path updated to v2.The core template import has been correctly updated to use the v2 module path.
slim/slim.go (1)
13-13: LGTM! Import path updated to v2.The core template import has been correctly updated to use the v2 module path.
handlebars/handlebars_test.go (2)
14-14: LGTM! Decoupling tests from Fiber types.Introducing
customMapas a local type alias removes the dependency onfiber.Mapin tests, allowing the template engine to be tested independently. This is a good practice for unit testing.
30-32: LGTM! Consistent test updates.All test cases have been consistently updated to use
customMapinstead offiber.Map, maintaining test coverage while decoupling from Fiber framework types.Also applies to: 41-43, 57-59, 73-75, 90-92
handlebars/handlebars.go (2)
13-13: LGTM! Import path updated to v2.The core template import has been correctly updated to use the v2 module path.
158-159: LGTM! Centralized binding normalization.Using
core.AcquireViewContext(binding)replaces manual type-switching logic with a centralized helper that normalizes various binding inputs (maps, pointers, nil values). This reduces code duplication and ensures consistent binding handling across template engines.mustache/mustache_test.go (2)
14-14: LGTM! Decoupling tests from Fiber types.Introducing
customMapremoves the dependency onfiber.Map, allowing independent testing of the template engine.
30-32: LGTM! Consistent test updates.All test cases have been consistently updated to use
customMap, maintaining test coverage while decoupling from Fiber framework types.Also applies to: 41-43, 57-59, 73-75, 89-91
mustache/README.md (1)
52-53: The version concern is incorrect; ignore the version-related verification request.The README example correctly references
github.com/gofiber/template/mustache/v3because the mustache module is versioned as v3 (permustache/go.mod). The implementation's use ofgithub.com/gofiber/template/v2is also correct—it references the core template module, which is versioned as v2 at the monorepo root. These are two different modules in the same repository with intentionally different versions.The formatting issue is valid: the import section uses hard tabs (
^Iincat -Aoutput) and should use spaces for consistency.Likely an incorrect or invalid review comment.
django/django_test.go (1)
120-123: Good replacement for fiber.Map in tests.Using a local custom map type validates the new binding normalization path without pulling Fiber as a test dep. LGTM.
django/README.md (1)
52-54: Verified: django/v4 module path is correctly published and referenced.The django/go.mod file declares
module github.com/gofiber/template/django/v4, and the import in django/README.md lines 52-54 correctly references"github.com/gofiber/template/django/v4". The module path is published and properly configured.README.md (1)
13-15: Remove suggestion to update badge target to v3—template/v3 does not exist.The badge correctly targets template/v2. The gofiber/template package documentation shows instructions like "go get -u github.com/gofiber/template/any_template_engine/vX", and Fiber v3 documentation explicitly uses template/html/v2. Only template subpackages (such as django/v3) have v3 variants; a v3 root package does not exist on pkg.go.dev. The current badge pointing to template/v2 aligns with official Fiber documentation and is the intended version.
jet/jet.go (1)
14-14: No action required—core import version is intentional and correct.The import of
core "github.com/gofiber/template/v2"in jet/jet.go (v3 engine) is by design. The jet/go.mod explicitly requiresgithub.com/gofiber/template/v2 v2.0.0with a replace directive pointing to the root module. All engines (v3 and v4) follow this same pattern: they wrap core v2 with engine-specific major versions. This is not a mixed-major-version surprise but a well-structured multi-module architecture.django/django.go (2)
162-188: Binding normalization + key sanitization look good.The reflective map handling and sanitizePongoContext correctly accept string-key maps (incl. custom types) and filter invalid identifiers.
Consider adding tests for: pongo2.Context passthrough; map[string]interface{}; custom map type; non-map inputs; invalid keys; nil map.
Also applies to: 190-203
14-15: Version mismatch concern is invalid; no changes required.The import of
github.com/gofiber/template/v2is correct and intentional. This monorepo structure separates the core template library (v2) from specific template engine bindings (django/v4, html/v3, etc.). The django package module is v4 (the binding version), while it correctly depends on the core template/v2 library—confirmed by the explicitrequireandreplacedirectives indjango/go.mod. The code and updated documentation are aligned.Likely an incorrect or invalid review comment.
| "github.com/gofiber/fiber/v3" | ||
| "github.com/gofiber/template/ace/v3" |
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.
🧩 Analysis chain
Verify version consistency across documentation and implementation.
The README example references github.com/gofiber/fiber/v3 and github.com/gofiber/template/ace/v3, but the actual template engine implementations in this PR (pug.go, html.go, slim.go) import github.com/gofiber/template/v2. Please confirm:
- Does
ace/v3exist and is it compatible with thetemplate/v2core used by other engines? - Should the documentation reference v3 while the implementations remain on v2?
Additionally, replace hard tabs with spaces on these lines to comply with markdown formatting standards.
Apply this diff to fix the indentation:
import (
- "log"
-
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/ace/v3"
+ "log"
+
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/ace/v3"
)I need to examine the codebase to verify the concerns raised in the review comment. Let me investigate the actual imports and file structure.
🏁 Script executed:
#!/bin/bash
# Find and examine template engine implementation files
echo "=== Searching for template engine files ==="
fd -e go -path "*template*" | head -20
echo ""
echo "=== Examining ace directory structure ==="
fd -type f "ace" | head -20
echo ""
echo "=== Looking for implementation files (pug.go, html.go, slim.go, ace.go) ==="
fd "(pug|html|slim|ace)\.go$"
echo ""
echo "=== Checking ace/README.md content ==="
fd "README.md" -path "*ace*" -exec cat {} \;
echo ""
echo "=== Examining actual imports in template files ==="
if [ -f "pug.go" ]; then echo "=== pug.go ==="; grep -A5 "^import" pug.go; fi
if [ -f "html.go" ]; then echo "=== html.go ==="; grep -A5 "^import" html.go; fi
if [ -f "slim.go" ]; then echo "=== slim.go ==="; grep -A5 "^import" slim.go; fi
if [ -f "ace.go" ]; then echo "=== ace.go ==="; grep -A5 "^import" ace.go; fiLength of output: 812
🏁 Script executed:
#!/bin/bash
echo "=== ace/ace.go imports ==="
cat ace/ace.go | grep -A10 "^import"
echo ""
echo "=== html/html.go imports ==="
cat html/html.go | grep -A10 "^import"
echo ""
echo "=== pug/pug.go imports ==="
cat pug/pug.go | grep -A10 "^import"
echo ""
echo "=== slim/slim.go imports ==="
cat slim/slim.go | grep -A10 "^import"
echo ""
echo "=== ace/README.md lines 40-55 ==="
cat ace/README.md | sed -n '40,55p'
echo ""
echo "=== Checking for tabs in ace/README.md lines 46-47 ==="
cat ace/README.md | sed -n '46,47p' | od -c | head -20Length of output: 1018
🏁 Script executed:
#!/bin/bash
echo "=== Detailed view of ace/README.md lines 44-50 ==="
sed -n '44,50p' ace/README.md | cat -A
echo ""
echo "=== Full pug/pug.go imports section ==="
cat pug/pug.go | head -30Length of output: 662
🌐 Web query:
gofiber template ace v3 compatibility
💡 Result:
Short answer: There is no official github.com/gofiber/template/ace/v3 package — the Ace wrapper is published as v2. So there isn’t an official "ace v3" release to match Fiber v3; use github.com/gofiber/template/ace/v2 (or embed a compatible Ace engine) and the Fiber Views interface instead. Sources: Fiber template docs (Ace examples using ace/v2) and the gofiber/template listing. [1][2]
References
- Ace wrapper example (ace/v2). [1]
- gofiber/template package / supported engines listing. [2]
Update README.md to fix version inconsistency and formatting.
The version mismatch is confirmed: all template implementations (ace, html, slim) import github.com/gofiber/template/v2, but the README example references the non-existent github.com/gofiber/template/ace/v3. Change to ace/v2. Additionally, lines 46–47 contain literal tabs that should be spaces per markdown standards.
import (
- "log"
-
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/ace/v3"
+ "log"
+
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/ace/v2"
)🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
46-46: Hard tabs
Column: 1
(MD010, no-hard-tabs)
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In ace/README.md around lines 46–47, the README shows an incorrect import and
contains literal tabs; update the import path from
github.com/gofiber/template/ace/v3 to github.com/gofiber/template/ace/v2 to
match the rest of the templates, and replace any literal tab characters on those
lines with spaces to conform to Markdown formatting standards.
| "github.com/gofiber/fiber/v3" | ||
| "github.com/gofiber/template/amber/v3" |
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 indentation: replace hard tabs with spaces.
The code block uses hard tabs for indentation, which is inconsistent with Markdown best practices.
Apply this diff to fix the indentation:
import (
- "log"
-
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/amber/v3"
+ "log"
+
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/amber/v3"
)Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
46-46: Hard tabs
Column: 1
(MD010, no-hard-tabs)
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In amber/README.md around lines 46 to 47, the code block contains hard tab
characters for indentation; replace those tabs with spaces (use consistent
indentation, e.g., 4 spaces per tab) so the Markdown code block uses spaces
only, and ensure no other tab characters remain in that block to maintain
consistent formatting.
| "github.com/gofiber/fiber/v3" | ||
| "github.com/gofiber/template/handlebars/v3" |
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 indentation: replace hard tabs with spaces.
The code block uses hard tabs for indentation, which is inconsistent with Markdown best practices.
Apply this diff to fix the indentation:
import (
- "log"
-
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/handlebars/v3"
+ "log"
+
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/handlebars/v3"
)📝 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.
| "github.com/gofiber/fiber/v3" | |
| "github.com/gofiber/template/handlebars/v3" | |
| import ( | |
| "log" | |
| "github.com/gofiber/fiber/v3" | |
| "github.com/gofiber/template/handlebars/v3" | |
| ) |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In handlebars/README.md around lines 52 to 53 the fenced code block uses hard
tabs for indentation; replace those hard tab characters with spaces (use 4
spaces per indent) so the lines containing "github.com/gofiber/fiber/v3" and
"github.com/gofiber/template/handlebars/v3" are indented with spaces instead of
tabs, then save the file.
| func jetVarMap(binding interface{}) jet.VarMap { | ||
| var bind jet.VarMap | ||
| if binding == nil { | ||
| return nil | ||
| } | ||
|
|
||
| if bind, ok := binding.(jet.VarMap); ok { | ||
| return bind | ||
| } | ||
| switch binds := binding.(type) { | ||
| case map[string]interface{}: | ||
| bind = make(jet.VarMap) | ||
| for key, value := range binds { | ||
| bind.Set(key, value) | ||
| } | ||
| case fiber.Map: | ||
| bind = make(jet.VarMap) | ||
| for key, value := range binds { | ||
| bind.Set(key, value) | ||
| } | ||
| case jet.VarMap: | ||
| bind = binds | ||
|
|
||
| data := core.AcquireViewContext(binding) | ||
| bind := make(jet.VarMap) | ||
| for key, value := range data { | ||
| bind.Set(key, value) | ||
| } |
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.
Nil binding + layout can panic; always return a non-nil VarMap.
bind.Set(...) on a nil VarMap will panic when a layout is used. Ensure jetVarMap never returns nil.
Apply:
-func jetVarMap(binding interface{}) jet.VarMap {
- if binding == nil {
- return nil
- }
-
- if bind, ok := binding.(jet.VarMap); ok {
- return bind
- }
-
- data := core.AcquireViewContext(binding)
- bind := make(jet.VarMap)
- for key, value := range data {
- bind.Set(key, value)
- }
- return bind
-}
+func jetVarMap(binding interface{}) jet.VarMap {
+ // Fast path: already a VarMap
+ if bind, ok := binding.(jet.VarMap); ok {
+ return bind
+ }
+ // Normalize any map-like binding (including nil) to a map[string]interface{}
+ data := core.AcquireViewContext(binding)
+ vm := make(jet.VarMap, len(data)+1) // +1 for potential layout insertion
+ for k, v := range data {
+ vm.Set(k, v)
+ }
+ return vm
+}📝 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.
| func jetVarMap(binding interface{}) jet.VarMap { | |
| var bind jet.VarMap | |
| if binding == nil { | |
| return nil | |
| } | |
| if bind, ok := binding.(jet.VarMap); ok { | |
| return bind | |
| } | |
| switch binds := binding.(type) { | |
| case map[string]interface{}: | |
| bind = make(jet.VarMap) | |
| for key, value := range binds { | |
| bind.Set(key, value) | |
| } | |
| case fiber.Map: | |
| bind = make(jet.VarMap) | |
| for key, value := range binds { | |
| bind.Set(key, value) | |
| } | |
| case jet.VarMap: | |
| bind = binds | |
| data := core.AcquireViewContext(binding) | |
| bind := make(jet.VarMap) | |
| for key, value := range data { | |
| bind.Set(key, value) | |
| } | |
| func jetVarMap(binding interface{}) jet.VarMap { | |
| // Fast path: already a VarMap | |
| if bind, ok := binding.(jet.VarMap); ok { | |
| return bind | |
| } | |
| // Normalize any map-like binding (including nil) to a map[string]interface{} | |
| data := core.AcquireViewContext(binding) | |
| vm := make(jet.VarMap, len(data)+1) // +1 for potential layout insertion | |
| for k, v := range data { | |
| vm.Set(k, v) | |
| } | |
| return vm | |
| } |
🤖 Prompt for AI Agents
In jet/jet.go around lines 192 to 205, the function jetVarMap can return nil (or
leave bind nil) which causes bind.Set(...) to panic when used by a layout;
change the function to always return a non-nil jet.VarMap: when binding == nil
return make(jet.VarMap) (not nil), when binding already a jet.VarMap return it
as-is, and when constructing from core.AcquireViewContext always initialize bind
:= make(jet.VarMap) and return bind at the end so the function never returns
nil.
| "github.com/gofiber/fiber/v3" | ||
| "github.com/gofiber/template/pug/v3" |
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 indentation: replace hard tabs with spaces.
The code block uses hard tabs for indentation, which is inconsistent with Markdown best practices.
Apply this diff to fix the indentation:
import (
- "log"
+ "log"
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/pug/v3"
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/pug/v3"
- // "net/http" // embedded system
+ // "net/http" // embedded system
)Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
48-48: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In pug/README.md around lines 47 to 48, the code block uses hard tab characters
for indentation; replace those tabs with spaces (preferably 2 spaces per indent
or match repository style) so the Markdown code block uses spaces instead of
hard tabs, ensuring consistent indentation across the file and saving the file
without tab characters in that block.
| val := reflect.ValueOf(binding) | ||
| if val.Kind() == reflect.Pointer { | ||
| if val.IsNil() { | ||
| return make(map[string]interface{}) | ||
| } | ||
| val = val.Elem() | ||
| } |
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.
Compile fix: use reflect.Ptr (not reflect.Pointer).
reflect.Kind uses Ptr. Current code won’t compile.
- if val.Kind() == reflect.Pointer {
+ if val.Kind() == reflect.Ptr {📝 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.
| val := reflect.ValueOf(binding) | |
| if val.Kind() == reflect.Pointer { | |
| if val.IsNil() { | |
| return make(map[string]interface{}) | |
| } | |
| val = val.Elem() | |
| } | |
| val := reflect.ValueOf(binding) | |
| if val.Kind() == reflect.Ptr { | |
| if val.IsNil() { | |
| return make(map[string]interface{}) | |
| } | |
| val = val.Elem() | |
| } |
🤖 Prompt for AI Agents
In template.go around lines 145 to 151, the code checks reflect.Kind using the
non-existent constant reflect.Pointer which causes a compile error; change the
check to use reflect.Ptr, ensure the Nil and Elem logic remains the same (i.e.,
if val.Kind() == reflect.Ptr { if val.IsNil() { return
make(map[string]interface{}) } val = val.Elem() }) so the code compiles and
handles nil pointers correctly.
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 (10)
handlebars/README.md (1)
52-53: ** Fix indentation: replace hard tabs with spaces.**This Markdown formatting issue has already been flagged in previous reviews. Replace hard tabs with spaces throughout the code block.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/handlebars/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/handlebars/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 69-74
mustache/README.md (1)
52-53: ** Fix indentation: replace hard tabs with spaces.**Same Markdown formatting issue as other engine READMEs. Replace hard tabs with spaces.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/mustache/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/mustache/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 70-82
ace/README.md (2)
46-47: ** Fix indentation: replace hard tabs with spaces.**Replace hard tabs with spaces in import block and route handlers.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/ace/v2" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/ace/v2" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 63-75
46-47: Version mismatch:ace/v3does not exist—useace/v2.A previous review verified that there is no official
github.com/gofiber/template/ace/v3package; the Ace engine remains on v2. Update the import to match the actual module path.import ( - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/ace/v3" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/ace/v2"amber/README.md (1)
46-47: ** Fix indentation: replace hard tabs with spaces.**Markdown formatting: replace hard tabs with spaces.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/amber/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/amber/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 63-75
pug/README.md (1)
47-48: ** Fix indentation: replace hard tabs with spaces.**Markdown formatting issue: replace hard tabs with spaces in import and route handler blocks.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/pug/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/pug/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 66-78
slim/README.md (1)
47-48: ** Fix indentation: replace hard tabs with spaces.**Markdown formatting issue: replace hard tabs with spaces throughout the code block.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/slim/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/slim/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 66-78
html/README.md (1)
63-64: ** Fix indentation: replace hard tabs with spaces.**Multiple code blocks use hard tabs; replace with spaces for Markdown compliance.
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/html/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/html/v3" ) - app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { - // Render index within layouts/main - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }, "layouts/main") - }) - - app.Get("/layouts-nested", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error { + // Render index within layouts/main + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }, "layouts/main") + }) + + app.Get("/layouts-nested", func(c fiber.Ctx) error {Apply similar formatting fixes to other code examples (lines 116–117, 166–167, 185–190).
Also applies to: 80-85, 87-92, 116-117, 166-167, 185-190
README.md (2)
52-52: ** Fix indentation: replace hard tabs with spaces.**Multiple code examples use hard tabs instead of spaces. Replace tabs with spaces for Markdown compliance (MD010).
Also applies to: 141-141, 166-166, 191-191, 217-217
38-38: Go version requirement1.25is unreleased—use1.22.Go 1.25 has not been released. A previous review identified this and noted that
reflect.MapRange(required by the code) was added in Go 1.22. Update the requirement to reflect the actual minimum.-> Go version `1.22` or higher is required.
🧹 Nitpick comments (1)
README.md (1)
13-13: Consider updating documentation link to v3.The godoc badge links to
/v2?tab=doc, but the PR upgrades to v3. Verify whether the link should be updated to/v3?tab=docfor consistency.- <a href="https://pkg.go.dev/github.com/gofiber/template/v2?tab=doc"> + <a href="https://pkg.go.dev/github.com/gofiber/template/v3?tab=doc">
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
README.md(8 hunks)ace/README.md(2 hunks)amber/README.md(2 hunks)django/README.md(4 hunks)handlebars/README.md(2 hunks)html/README.md(6 hunks)jet/README.md(2 hunks)mustache/README.md(2 hunks)pug/README.md(2 hunks)slim/README.md(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- jet/README.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
html/README.md
63-63: Hard tabs
Column: 1
(MD010, no-hard-tabs)
64-64: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
83-83: Hard tabs
Column: 1
(MD010, no-hard-tabs)
84-84: Hard tabs
Column: 1
(MD010, no-hard-tabs)
85-85: Hard tabs
Column: 1
(MD010, no-hard-tabs)
87-87: Hard tabs
Column: 1
(MD010, no-hard-tabs)
88-88: Hard tabs
Column: 1
(MD010, no-hard-tabs)
89-89: Hard tabs
Column: 1
(MD010, no-hard-tabs)
90-90: Hard tabs
Column: 1
(MD010, no-hard-tabs)
91-91: Hard tabs
Column: 1
(MD010, no-hard-tabs)
92-92: Hard tabs
Column: 1
(MD010, no-hard-tabs)
94-94: Hard tabs
Column: 1
(MD010, no-hard-tabs)
README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
58-58: Hard tabs
Column: 1
(MD010, no-hard-tabs)
59-59: Hard tabs
Column: 1
(MD010, no-hard-tabs)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
ace/README.md
64-64: Hard tabs
Column: 1
(MD010, no-hard-tabs)
65-65: Hard tabs
Column: 1
(MD010, no-hard-tabs)
66-66: Hard tabs
Column: 1
(MD010, no-hard-tabs)
67-67: Hard tabs
Column: 1
(MD010, no-hard-tabs)
69-69: Hard tabs
Column: 1
(MD010, no-hard-tabs)
70-70: Hard tabs
Column: 1
(MD010, no-hard-tabs)
handlebars/README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
69-69: Hard tabs
Column: 1
(MD010, no-hard-tabs)
70-70: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
73-73: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
76-76: Hard tabs
Column: 1
(MD010, no-hard-tabs)
mustache/README.md
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
70-70: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
73-73: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
75-75: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
pug/README.md
66-66: Hard tabs
Column: 1
(MD010, no-hard-tabs)
67-67: Hard tabs
Column: 1
(MD010, no-hard-tabs)
69-69: Hard tabs
Column: 1
(MD010, no-hard-tabs)
70-70: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
73-73: Hard tabs
Column: 1
(MD010, no-hard-tabs)
slim/README.md
47-47: Hard tabs
Column: 1
(MD010, no-hard-tabs)
48-48: Hard tabs
Column: 1
(MD010, no-hard-tabs)
66-66: Hard tabs
Column: 1
(MD010, no-hard-tabs)
67-67: Hard tabs
Column: 1
(MD010, no-hard-tabs)
68-68: Hard tabs
Column: 1
(MD010, no-hard-tabs)
69-69: Hard tabs
Column: 1
(MD010, no-hard-tabs)
70-70: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
73-73: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🔇 Additional comments (2)
django/README.md (2)
46-86: Example code correctly updated to Fiber v3.The imports and handler signatures are properly updated and consistent with Fiber v3 conventions. Code is syntactically correct and complete.
100-134: Embedded filesystem example correctly updated to Fiber v3.The embedded filesystem example maintains proper structure with correct v3 imports and handler signatures. The
//go:embeddirective andNewPathForwardingFileSystemusage are appropriate.
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
🧹 Nitpick comments (10)
pug/README.md (1)
12-18: Approve v3 migration changes; address hard tab formatting.The Installation section and v3 imports are correct and align with PR objectives. The handler signature changes from
*fiber.Ctxtofiber.Ctxare consistent with Fiber v3 API. However, the code block contains hard tabs (lines 55–56 and 74–82), which violates Markdown linting standards (MD010).Apply this diff to replace hard tabs with spaces:
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/pug/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/pug/v3" - // "net/http" // embedded system + // "net/http" // embedded system )And similarly for the route handlers (lines 74–82):
- app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 55-56, 74-74, 81-81
jet/README.md (1)
17-17: Address version inconsistency between go get and import statements.Line 17 specifies
go get github.com/gofiber/template/jet/v4, but lines 60–61 importjet/v3. This inconsistency will confuse users and likely cause installation issues. Verify the correct Jet version for this PR and ensure both the go get command and import paths match.Additionally, replace hard tabs with spaces in the code blocks (lines 60–61 and 77–82).
Also applies to: 60-61
mustache/README.md (1)
17-17: Address version inconsistency between go get and import statements.Line 17 specifies
go get github.com/gofiber/template/mustache/v4, but lines 60–61 importmustache/v3. This mismatch will cause installation failures. Verify the correct Mustache package version for this PR and align both the installation command and import paths.Additionally, replace hard tabs with spaces in the code blocks (lines 60–61 and 78–82).
Also applies to: 60-61
README.md (1)
38-43: Approve comprehensive v3 migration; address indentation inconsistencies.The main README documentation comprehensively updates all template engine examples and installation instructions for Fiber v3, which aligns well with the PR objectives. The v3 imports and handler signature changes are correct.
However, indentation is inconsistent across code examples: some lines use hard tabs while others use leading spaces. Standardize all code blocks to use spaces (4 spaces per indent) for Markdown compliance. Specifically, lines 52, 141, 166, 191 should match the style of surrounding code.
Example fix for lines 52:
import ( "log" - "github.com/gofiber/fiber/v3" + "github.com/gofiber/fiber/v3" // To use a specific template engine, import as shown below: - // "github.com/gofiber/template/pug/v3" - // "github.com/gofiber/template/mustache/v3" + // "github.com/gofiber/template/pug/v3" + // "github.com/gofiber/template/mustache/v3" // etc..Also applies to: 52-52, 96-96, 103-103, 141-142, 166-167, 191-192, 217-218
slim/README.md (1)
12-18: Approve v3 migration changes; address hard tab formatting.The Installation section and v3 imports are correct and consistent throughout. The handler signature changes from
*fiber.Ctxtofiber.Ctxalign with Fiber v3 API standards. However, the code block contains hard tabs (lines 55–56 and 74–82), which violates Markdown linting standards (MD010).Apply this diff to replace hard tabs with spaces:
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/slim/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/slim/v3" - // "net/http" // embedded system + // "net/http" // embedded system )And for the route handlers (lines 74–86):
- app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 55-56, 74-74, 81-81
amber/README.md (1)
17-17: Verify template package version consistency and address hard tab formatting.The Installation section and import updates target v3. Verify that
github.com/gofiber/template/amber/v3is the correct published version for this PR. (A similar version mismatch issue was identified in ace/README.md during review, where ace/v3 does not exist.)Additionally, replace hard tabs with spaces in the code blocks (lines 55 and 71–83):
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/amber/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/amber/v3" )Also applies to: 54-55, 71-71, 78-78
handlebars/README.md (1)
12-18: Approve v3 migration changes; address hard tab formatting.The Installation section and v3 imports are correct and align with the PR v3 migration objectives. The handler signature changes from
*fiber.Ctxtofiber.Ctxare consistent with Fiber v3 API. However, the code block contains hard tabs (lines 60–61 and 77–82), which violates Markdown linting standards (MD010).Apply this diff to replace hard tabs with spaces:
import ( - "log" - - "github.com/gofiber/fiber/v3" - "github.com/gofiber/template/handlebars/v3" + "log" + + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/handlebars/v3" )And for the route handlers (lines 77–89):
- app.Get("/", func(c fiber.Ctx) error { - // Render index - return c.Render("index", fiber.Map{ - "Title": "Hello, World!", - }) - }) - - app.Get("/layout", func(c fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { + // Render index + return c.Render("index", fiber.Map{ + "Title": "Hello, World!", + }) + }) + + app.Get("/layout", func(c fiber.Ctx) error {Also applies to: 60-61, 77-77, 84-84
django/README.md (1)
14-14: Optional: Wrap bare URL in markdown link syntax.The bare URL on this line could optionally be wrapped for better markdown style consistency:
-Go version support: We only support the latest two versions of Go. Visit https://go.dev/doc/devel/release for more information. +Go version support: We only support the latest two versions of Go. Visit [Go releases](https://go.dev/doc/devel/release) for more information.html/README.md (2)
14-14: Optional: Wrap bare URL in markdown link syntax.The bare URL could be wrapped for better markdown style consistency:
-Go version support: We only support the latest two versions of Go. Visit https://go.dev/doc/devel/release for more information. +Go version support: We only support the latest two versions of Go. Visit [Go releases](https://go.dev/doc/devel/release) for more information.
16-16: Optional: Specify language for fenced code block.Adding a language specifier improves markdown rendering:
-``` +```sh go get github.com/gofiber/template/html/v3 -``` +```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
.github/workflows/golangci-lint.ymlis excluded by!**/*.yml.golangci.ymlis excluded by!**/*.yml
📒 Files selected for processing (10)
README.md(8 hunks)ace/README.md(3 hunks)amber/README.md(3 hunks)django/README.md(5 hunks)handlebars/README.md(3 hunks)html/README.md(7 hunks)jet/README.md(3 hunks)mustache/README.md(3 hunks)pug/README.md(3 hunks)slim/README.md(3 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/recipes#0
File: :0-0
Timestamp: 2024-11-26T20:05:15.793Z
Learning: For future contributions to the `gofiber/recipes` repository, ensure that the tasks outlined in `.github/CONTRIBUTING.md` are incorporated, including creating a new directory without a "fiber" prefix, adding a `README.md` with Docusaurus metadata, and updating the overview by running `make generate`.
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`.
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:24:06.083Z
Learning: When customizing the Fiber context to achieve version independence, using generics in methods like `Status` and `Type` allows for fluent method chaining. Implementing a generic interface for `Ctx` on the `App` prevents class switching when registering custom contexts that use fluent methods. Providing multiple `New` methods allows users who do not wish to customize the context to continue using `fiber.New` without changes.
📚 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:
pug/README.mdmustache/README.mdace/README.mdREADME.mdslim/README.mdhtml/README.mdamber/README.mddjango/README.mdhandlebars/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:
pug/README.mdjet/README.mdmustache/README.mdace/README.mdREADME.mdslim/README.mdhtml/README.mdamber/README.mdhandlebars/README.md
📚 Learning: 2024-12-01T01:15:48.126Z
Learnt from: juls0730
PR: gofiber/recipes#2710
File: tableflip/main.go:61-62
Timestamp: 2024-12-01T01:15:48.126Z
Learning: In the GoFiber `tableflip` recipe (`tableflip/main.go`), the implementation matches the upstream reference implementation. Future code suggestions should consider maintaining this alignment to ensure consistency.
Applied to files:
pug/README.mdace/README.mdREADME.mdamber/README.mdhandlebars/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:
pug/README.mdjet/README.mdmustache/README.mdace/README.mdREADME.mdslim/README.mdhtml/README.mdamber/README.mddjango/README.mdhandlebars/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:
pug/README.mdjet/README.mdmustache/README.mdace/README.mdREADME.mdslim/README.mdhtml/README.mdamber/README.mddjango/README.mdhandlebars/README.md
📚 Learning: 2025-02-12T11:24:31.153Z
Learnt from: ReneWerner87
PR: gofiber/storage#0
File: :0-0
Timestamp: 2025-02-12T11:24:31.153Z
Learning: The storage package in gofiber/storage repository can be used independently of the Fiber web framework.
Applied to files:
pug/README.mdjet/README.mdmustache/README.mdace/README.mdREADME.mdslim/README.mdhtml/README.mdamber/README.mdhandlebars/README.md
📚 Learning: 2024-11-23T19:35:36.767Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/main.go:0-0
Timestamp: 2024-11-23T19:35:36.767Z
Learning: In the Go `clean-code` example (`clean-code/app/main.go`) in the `gofiber/recipes` repository, it's acceptable to omit graceful shutdown handling, as the example code prioritizes simplicity over production-level practices.
Applied to files:
jet/README.mdmustache/README.mdace/README.mdREADME.mdhtml/README.mdamber/README.mdhandlebars/README.md
📚 Learning: 2024-11-26T20:05:15.793Z
Learnt from: ReneWerner87
PR: gofiber/recipes#0
File: :0-0
Timestamp: 2024-11-26T20:05:15.793Z
Learning: For future contributions to the `gofiber/recipes` repository, ensure that the tasks outlined in `.github/CONTRIBUTING.md` are incorporated, including creating a new directory without a "fiber" prefix, adding a `README.md` with Docusaurus metadata, and updating the overview by running `make generate`.
Applied to files:
ace/README.md
📚 Learning: 2025-10-14T12:26:25.474Z
Learnt from: efectn
PR: gofiber/fiber#3802
File: listen.go:459-466
Timestamp: 2025-10-14T12:26:25.474Z
Learning: Go 1.21 and later versions include builtin `min` and `max` functions that work with ordered types. These do not need to be imported or defined manually. When reviewing Go code, check the `go.mod` version before flagging `min` or `max` as undefined.
Applied to files:
README.md
📚 Learning: 2025-09-18T00:32:59.671Z
Learnt from: sixcolors
PR: gofiber/fiber#0
File: :0-0
Timestamp: 2025-09-18T00:32:59.671Z
Learning: In Go 1.22, manual copying of loop variables (like `x := x`) is no longer necessary due to the fix for variable capture in closures. Each loop iteration now creates its own instance of the loop variable automatically.
Applied to files:
README.md
📚 Learning: 2025-05-13T00:19:16.407Z
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
Applied to files:
README.md
📚 Learning: 2025-05-07T13:07:33.899Z
Learnt from: mdelapenya
PR: gofiber/fiber#3434
File: docs/api/services.md:39-43
Timestamp: 2025-05-07T13:07:33.899Z
Learning: When documenting Go interface methods in the Fiber project, avoid showing method signatures with the interface type as the receiver (e.g., `func (d *Service) Method()`) since interfaces cannot be used as receivers in Go. Instead, show just the method signature without a receiver or use a placeholder implementation name.
Applied to files:
README.md
📚 Learning: 2024-09-25T16:18:34.719Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/config.go:122-122
Timestamp: 2024-09-25T16:18:34.719Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.
Applied to files:
html/README.mddjango/README.md
🪛 markdownlint-cli2 (0.18.1)
pug/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
56-56: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
75-75: Hard tabs
Column: 1
(MD010, no-hard-tabs)
76-76: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
jet/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
61-61: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
84-84: Hard tabs
Column: 1
(MD010, no-hard-tabs)
mustache/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
61-61: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
83-83: Hard tabs
Column: 1
(MD010, no-hard-tabs)
85-85: Hard tabs
Column: 1
(MD010, no-hard-tabs)
ace/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
75-75: Hard tabs
Column: 1
(MD010, no-hard-tabs)
76-76: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
slim/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
56-56: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
75-75: Hard tabs
Column: 1
(MD010, no-hard-tabs)
76-76: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
html/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
88-88: Hard tabs
Column: 1
(MD010, no-hard-tabs)
89-89: Hard tabs
Column: 1
(MD010, no-hard-tabs)
90-90: Hard tabs
Column: 1
(MD010, no-hard-tabs)
91-91: Hard tabs
Column: 1
(MD010, no-hard-tabs)
92-92: Hard tabs
Column: 1
(MD010, no-hard-tabs)
93-93: Hard tabs
Column: 1
(MD010, no-hard-tabs)
95-95: Hard tabs
Column: 1
(MD010, no-hard-tabs)
96-96: Hard tabs
Column: 1
(MD010, no-hard-tabs)
97-97: Hard tabs
Column: 1
(MD010, no-hard-tabs)
98-98: Hard tabs
Column: 1
(MD010, no-hard-tabs)
99-99: Hard tabs
Column: 1
(MD010, no-hard-tabs)
100-100: Hard tabs
Column: 1
(MD010, no-hard-tabs)
102-102: Hard tabs
Column: 1
(MD010, no-hard-tabs)
amber/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
71-71: Hard tabs
Column: 1
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 1
(MD010, no-hard-tabs)
74-74: Hard tabs
Column: 1
(MD010, no-hard-tabs)
75-75: Hard tabs
Column: 1
(MD010, no-hard-tabs)
76-76: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
django/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
61-61: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
84-84: Hard tabs
Column: 1
(MD010, no-hard-tabs)
116-116: Hard tabs
Column: 1
(MD010, no-hard-tabs)
117-117: Hard tabs
Column: 1
(MD010, no-hard-tabs)
132-132: Hard tabs
Column: 1
(MD010, no-hard-tabs)
handlebars/README.md
14-14: Bare URL used
(MD034, no-bare-urls)
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
61-61: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
84-84: Hard tabs
Column: 1
(MD010, no-hard-tabs)
⏰ 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). (8)
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Compare
- GitHub Check: Tests (1.25.x, windows-latest)
- GitHub Check: Tests (1.25.x, windows-latest)
🔇 Additional comments (13)
django/README.md (5)
12-18: Installation section is well-structured and informative.Addition of Go version support guidance and clear installation instructions for v4 is appropriate.
60-61: Import updates correctly reflect Fiber v3 and Django v4.
77-77: Handler signatures correctly updated to Fiber v3 value-receiver pattern.The change from
func(c *fiber.Ctx)tofunc(c fiber.Ctx)aligns with Fiber v3's updated API.Also applies to: 84-84
116-117: Embedded filesystem example imports are consistent with v3 migration.
132-132: Embedded filesystem handler signature correctly uses Fiber v3 pattern.html/README.md (8)
12-18: Installation section clearly documents v3 installation and Go version requirements.
71-72: Fiber v3 and HTML v3 imports correctly specified.
88-88: Handler signatures correctly use Fiber v3 value-receiver pattern.Also applies to: 95-95
102-107: New nested layout example is a valuable addition for demonstrating v3 capabilities.The nested layout pattern showing multiple base layouts is a helpful example for users learning the v3 rendering capabilities.
124-125: Embedded filesystem example imports correctly reflect v3 versions.
140-140: Embedded filesystem handler uses correct v3 signature.
174-175: innerHTML example imports correctly specify v3 versions.
193-193: innerHTML handler correctly uses v3 value-receiver pattern.
| Go version support: We only support the latest two versions of Go. Visit https://go.dev/doc/devel/release for more information. | ||
|
|
||
| ``` | ||
| go get github.com/gofiber/template/ace/v3 |
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.
Critical: Incorrect template package version in imports.
The README references github.com/gofiber/template/ace/v3, which does not exist. The Ace template package is only published as v2. This will cause go get to fail for users following this example.
Apply this diff to correct the version:
-go get github.com/gofiber/template/ace/v3
+go get github.com/gofiber/template/ace/v2And update the import:
import (
- "log"
-
- "github.com/gofiber/fiber/v3"
- "github.com/gofiber/template/ace/v3"
+ "log"
+
+ "github.com/gofiber/fiber/v3"
+ "github.com/gofiber/template/ace/v2"
)Additionally, replace hard tabs with spaces in all code blocks (lines 55, 71–82).
Also applies to: 54-55
🤖 Prompt for AI Agents
In ace/README.md around line 17 (and also lines 54–55, 55, and 71–82), the
README references the non-existent module path
github.com/gofiber/template/ace/v3; update all occurrences to the published v2
path (github.com/gofiber/template/ace/v2) both in the example go get command and
in the import statements, and replace any hard tabs in the shown code blocks
(lines 55 and 71–82) with spaces so code formatting is consistent.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68f20eafcc0483268698654a89a5a918
Summary by CodeRabbit
New Features
Chores
Tests