-
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
Changes from 2 commits
83027db
0c90d1d
83c9935
9e9a3d7
86c106b
ea018a7
05b6534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,39 @@ | ||
| name: Govulncheck Security Scan | ||
| on: | ||
| push: | ||
| branches: | ||
| - "master" | ||
| - "main" | ||
| paths-ignore: | ||
| - "**.md" | ||
| - LICENSE | ||
| - ".github/ISSUE_TEMPLATE/*.yml" | ||
| - ".github/dependabot.yml" | ||
| pull_request: | ||
| branches: | ||
| - "*" | ||
| paths-ignore: | ||
| - "**.md" | ||
| - LICENSE | ||
| - ".github/ISSUE_TEMPLATE/*.yml" | ||
| - ".github/dependabot.yml" | ||
| jobs: | ||
| govulncheck-check: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GO111MODULE: on | ||
| steps: | ||
| - name: Fetch Repository | ||
| uses: actions/checkout@v5 | ||
| - name: Install Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 'stable' | ||
| check-latest: true | ||
| cache: false | ||
| - name: Install Govulncheck | ||
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | ||
| - name: Run Govulncheck | ||
| run: govulncheck ./... | ||
| name: Govulncheck Security Scan | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "master" | ||
| - "main" | ||
| paths-ignore: | ||
| - "**.md" | ||
| - LICENSE | ||
| - ".github/ISSUE_TEMPLATE/*.yml" | ||
| - ".github/dependabot.yml" | ||
| pull_request: | ||
| branches: | ||
| - "*" | ||
| paths-ignore: | ||
| - "**.md" | ||
| - LICENSE | ||
| - ".github/ISSUE_TEMPLATE/*.yml" | ||
| - ".github/dependabot.yml" | ||
|
|
||
| jobs: | ||
| govulncheck-check: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GO111MODULE: on | ||
| steps: | ||
| - name: Fetch Repository | ||
| uses: actions/checkout@v5 | ||
| - name: Install Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.25.x' | ||
| check-latest: false | ||
| cache: false | ||
| - name: Install Govulncheck | ||
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | ||
| - name: Run Govulncheck | ||
| run: govulncheck ./... |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ sidebar_position: 1 | |||||
| <img height="125" alt="Fiber" src="https://raw.githubusercontent.com/gofiber/template/master/.github/logo.svg#gh-light-mode-only" /> | ||||||
| <br/> | ||||||
|
|
||||||
| <a href="https://pkg.go.dev/github.com/gofiber/template?tab=doc"> | ||||||
| <a href="https://pkg.go.dev/github.com/gofiber/template/v2?tab=doc"> | ||||||
| <img src="https://img.shields.io/badge/%F0%9F%93%9A%20godoc-pkg-00ACD7.svg?color=00ACD7&style=flat"/> | ||||||
| </a> | ||||||
| <a href="https://goreportcard.com/report/github.com/gofiber/template"> | ||||||
|
|
@@ -35,10 +35,10 @@ This package provides universal methods to use multiple template engines with th | |||||
| - [slim](./slim/README.md) <a href="https://github.com/gofiber/template/actions?query=workflow%3A%22Tests+Slim%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/template/test-slim.yml?branch=master&label=%F0%9F%A7%AA%20&style=flat&color=75C46B"/></a> | ||||||
|
|
||||||
| ### Installation | ||||||
| > Go version `1.17` or higher is required. | ||||||
| > Go version `1.25` or higher is required. | ||||||
|
|
||||||
| ``` | ||||||
| go get -u github.com/gofiber/fiber/v2 | ||||||
| go get -u github.com/gofiber/fiber/v3 | ||||||
| go get -u github.com/gofiber/template/any_template_engine/vX | ||||||
| ``` | ||||||
|
|
||||||
|
|
@@ -49,15 +49,15 @@ package main | |||||
| import ( | ||||||
| "log" | ||||||
|
|
||||||
| "github.com/gofiber/fiber/v2" | ||||||
| "github.com/gofiber/fiber/v3" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
|
||||||
|
|
||||||
| // To use a specific template engine, import as shown below: | ||||||
| // "github.com/gofiber/template/pug" | ||||||
| // "github.com/gofiber/template/mustache" | ||||||
| // "github.com/gofiber/template/pug/v3" | ||||||
| // "github.com/gofiber/template/mustache/v3" | ||||||
| // etc.. | ||||||
|
|
||||||
| // In this example we use the html template engine | ||||||
| "github.com/gofiber/template/html/v2" | ||||||
| "github.com/gofiber/template/html/v3" | ||||||
| ) | ||||||
|
|
||||||
| func main() { | ||||||
|
|
@@ -93,14 +93,14 @@ func main() { | |||||
|
|
||||||
| // To render a template, you can call the ctx.Render function | ||||||
| // Render(tmpl string, values interface{}, layout ...string) | ||||||
| app.Get("/", func(c *fiber.Ctx) error { | ||||||
| app.Get("/", func(c fiber.Ctx) error { | ||||||
| return c.Render("index", fiber.Map{ | ||||||
| "Title": "Hello, World!", | ||||||
| }) | ||||||
| }) | ||||||
|
|
||||||
| // Render with layout example | ||||||
| app.Get("/layout", func(c *fiber.Ctx) error { | ||||||
| app.Get("/layout", func(c fiber.Ctx) error { | ||||||
| return c.Render("index", fiber.Map{ | ||||||
| "Title": "Hello, World!", | ||||||
| }, "layouts/main") | ||||||
|
|
@@ -138,8 +138,8 @@ package main | |||||
| import ( | ||||||
| "log" | ||||||
|
|
||||||
| "github.com/gofiber/fiber/v2" | ||||||
| "github.com/gofiber/template/html" | ||||||
| "github.com/gofiber/fiber/v3" | ||||||
| "github.com/gofiber/template/html/v3" | ||||||
|
|
||||||
| "github.com/markbates/pkger" | ||||||
| ) | ||||||
|
|
@@ -163,8 +163,8 @@ package main | |||||
| import ( | ||||||
| "log" | ||||||
|
|
||||||
| "github.com/gofiber/fiber/v2" | ||||||
| "github.com/gofiber/template/html" | ||||||
| "github.com/gofiber/fiber/v3" | ||||||
| "github.com/gofiber/template/html/v3" | ||||||
|
|
||||||
| "github.com/gobuffalo/packr/v2" | ||||||
| ) | ||||||
|
|
@@ -188,8 +188,8 @@ package main | |||||
| import ( | ||||||
| "log" | ||||||
|
|
||||||
| "github.com/gofiber/fiber/v2" | ||||||
| "github.com/gofiber/template/html" | ||||||
| "github.com/gofiber/fiber/v3" | ||||||
| "github.com/gofiber/template/html/v3" | ||||||
|
|
||||||
| "github.com/GeertJohan/go.rice" | ||||||
| ) | ||||||
|
|
@@ -214,8 +214,8 @@ package main | |||||
| import ( | ||||||
| "log" | ||||||
|
|
||||||
| "github.com/gofiber/fiber/v2" | ||||||
| "github.com/gofiber/template/html" | ||||||
| "github.com/gofiber/fiber/v3" | ||||||
| "github.com/gofiber/template/html/v3" | ||||||
| // your generated package | ||||||
| "github.com/<user>/<repo>/static" | ||||||
| ) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,8 @@ package main | |
| import ( | ||
| "log" | ||
|
|
||
| "github.com/gofiber/fiber/v2" | ||
| "github.com/gofiber/template/ace/v2" | ||
| "github.com/gofiber/fiber/v3" | ||
| "github.com/gofiber/template/ace/v3" | ||
|
Comment on lines
+54
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify version consistency across documentation and implementation. The README example references
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: 💡 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
Update README.md to fix version inconsistency and formatting. The version mismatch is confirmed: all template implementations (ace, html, slim) 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"
)🧰 Tools🪛 markdownlint-cli2 (0.18.1)46-46: Hard tabs (MD010, no-hard-tabs) 47-47: Hard tabs (MD010, no-hard-tabs) 🤖 Prompt for AI Agents |
||
| ) | ||
|
|
||
| func main() { | ||
|
|
@@ -60,14 +60,14 @@ func main() { | |
| Views: engine, | ||
| }) | ||
|
|
||
| app.Get("/", 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 { | ||
| app.Get("/layout", func(c fiber.Ctx) error { | ||
| // Render index within layouts/main | ||
| return c.Render("index", fiber.Map{ | ||
| "Title": "Hello, World!", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,11 +1,11 @@ | ||||||
| module github.com/gofiber/template/ace/v2 | ||||||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
|
|
||||||
| require github.com/yosssi/ace v0.0.5 | ||||||
|
|
||||||
| require ( | ||||||
| github.com/gofiber/template v1.8.3 | ||||||
| github.com/gofiber/template/v2 v2.0.0 | ||||||
| github.com/gofiber/utils v1.1.0 | ||||||
| github.com/stretchr/testify v1.11.1 | ||||||
| ) | ||||||
|
|
@@ -16,4 +16,4 @@ require ( | |||||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||||||
| ) | ||||||
|
|
||||||
| replace github.com/gofiber/template => ../. | ||||||
| replace github.com/gofiber/template/v2 => ../. | ||||||
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 usesreflect.MapRange, which was introduced in Go 1.22. I suggest setting the minimum required version to1.22.