Skip to content

📒 docs: fix invalid Go slice literal in middleware registration example#4095

Merged
ReneWerner87 merged 2 commits intomainfrom
copilot/fix-invalid-go-code-example
Feb 19, 2026
Merged

📒 docs: fix invalid Go slice literal in middleware registration example#4095
ReneWerner87 merged 2 commits intomainfrom
copilot/fix-invalid-go-code-example

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

The "Middleware Registration" example in docs/whats_new.md contained ["/v1", "/v2"] — a non-Go array syntax that does not compile.

Changes introduced

  • Documentation Update: Fixed ["/v1", "/v2"][]string{"/v1", "/v2"} in the app.Use multi-prefix example in docs/whats_new.md.
// Before (invalid — does not compile)
app.Use(["/v1", "/v2"], func(c fiber.Ctx) error {

// After (valid Go)
app.Use([]string{"/v1", "/v2"}, func(c fiber.Ctx) error {

Type of change

  • Documentation update (changes to documentation)

Checklist

  • Followed the inspiration of the Express.js framework for new functionalities, making them similar in usage.
  • Conducted a self-review of the code and provided comments for complex or critical parts.
  • Updated the documentation in the /docs/ directory for Fiber's documentation.
  • Added or updated unit tests to validate the effectiveness of the changes or new features.
  • Ensured that new and existing unit tests pass locally with the changes.
  • Verified that any new dependencies are essential and have been agreed upon by the maintainers/community.
  • Aimed for optimal performance with minimal allocations in the new code.
  • Provided benchmarks for the new code to analyze and improve upon.

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

Original prompt

This section details on the original issue you should resolve

<issue_title>🐛 [Bug]: Braindead AI slop machine has slopped incorrect Go code in the documentation</issue_title>
<issue_description>### Bug Description

Image

This is invalid Go code that doesn't compile.

How to Reproduce

Go to https://docs.gofiber.io/whats_new/#middleware-registration and open the example. it's invalid Go code.

Expected Behavior

Example code should be valid Go code.

Fiber Version

V3.x

Code Snippet (optional)

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ation example

Co-authored-by: ReneWerner87 <7063188+ReneWerner87@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix invalid Go code in documentation example 📒 docs: fix invalid Go slice literal in middleware registration example Feb 19, 2026
Copilot AI requested a review from ReneWerner87 February 19, 2026 23:14
@ReneWerner87 ReneWerner87 added this to v3 Feb 19, 2026
@ReneWerner87 ReneWerner87 added this to the v3 milestone Feb 19, 2026
@ReneWerner87 ReneWerner87 marked this pull request as ready for review February 19, 2026 23:16
@ReneWerner87 ReneWerner87 requested a review from a team as a code owner February 19, 2026 23:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an invalid Go snippet in the “Middleware registration” section of Fiber’s “What’s new” documentation so the example compiles and matches existing docs conventions.

Changes:

  • Replaced non-Go array literal syntax (["/v1", "/v2"]) with a valid Go slice literal ([]string{"/v1", "/v2"}) in the app.Use multi-prefix example.

@ReneWerner87 ReneWerner87 merged commit 45acdb0 into main Feb 19, 2026
16 checks passed
@ReneWerner87 ReneWerner87 deleted the copilot/fix-invalid-go-code-example branch February 19, 2026 23:19
@github-project-automation github-project-automation bot moved this to Done in v3 Feb 19, 2026
@ReneWerner87 ReneWerner87 modified the milestones: v3, v3.1.0 Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: incorrect Go code in the documentation

3 participants