Skip to content

Add command for migration purpose #120

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

Merged
merged 28 commits into from
Jul 12, 2025
Merged

Conversation

ReneWerner87
Copy link
Member

@ReneWerner87 ReneWerner87 commented Apr 18, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a CLI command to migrate Fiber projects to newer versions with automated source code and module updates.
    • Added a migration framework and versioned migration functions for seamless project upgrades.
    • Added a Makefile with common development commands for easier project management.
    • Added a development guide for local setup and live recompilation.
  • Bug Fixes

    • Improved error handling and resource management throughout the CLI and helper functions.
    • Enhanced test robustness by switching to stricter error assertions and modern Go APIs.
  • Refactor

    • Refactored code for clarity, consistent error propagation, and better struct organization.
    • Updated version retrieval logic for improved reliability and timeout handling.
  • Documentation

    • Improved formatting and readability in README, contributing, and code of conduct documents.
    • Updated issue and pull request templates for better structure and clarity.
  • Chores

    • Expanded .gitignore to cover more build artifacts and IDE files.

@ReneWerner87 ReneWerner87 added the ✏️ Feature New feature or request label Apr 18, 2024
@ReneWerner87 ReneWerner87 self-assigned this Apr 18, 2024
Copy link

welcome bot commented Apr 18, 2024

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Copy link

coderabbitai bot commented Apr 18, 2024

Warning

Rate limit exceeded

@ReneWerner87 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 39f8a57 and e438e7d.

⛔ Files ignored due to path filters (9)
  • .github/release-drafter.yml is excluded by !**/*.yml
  • .github/workflows/linter.yml is excluded by !**/*.yml
  • .github/workflows/markdown.yml is excluded by !**/*.yml
  • .github/workflows/security.yml is excluded by !**/*.yml
  • .github/workflows/vulncheck.yml is excluded by !**/*.yml
  • .golangci.yml is excluded by !**/*.yml
  • .markdownlint.yml is excluded by !**/*.yml
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (34)
  • .github/CODE_OF_CONDUCT.md (1 hunks)
  • .github/CONTRIBUTING.md (2 hunks)
  • .github/ISSUE_TEMPLATE/---bug.md (1 hunks)
  • .github/ISSUE_TEMPLATE/---feature.md (1 hunks)
  • .github/ISSUE_TEMPLATE/---question.md (1 hunks)
  • .github/pull_request_template.md (1 hunks)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • README.md (3 hunks)
  • cmd/dev.go (11 hunks)
  • cmd/dev_test.go (11 hunks)
  • cmd/helpers.go (3 hunks)
  • cmd/helpers_test.go (3 hunks)
  • cmd/internal/cmd.go (4 hunks)
  • cmd/internal/helpers.go (2 hunks)
  • cmd/internal/migrations/common.go (1 hunks)
  • cmd/internal/migrations/lists.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (1 hunks)
  • cmd/internal/migrations/v3/common_test.go (1 hunks)
  • cmd/internal/prompt.go (6 hunks)
  • cmd/internal/prompt_test.go (3 hunks)
  • cmd/internal/task.go (4 hunks)
  • cmd/migrate.go (1 hunks)
  • cmd/new.go (2 hunks)
  • cmd/new_test.go (2 hunks)
  • cmd/root.go (4 hunks)
  • cmd/root_test.go (7 hunks)
  • cmd/tester_test.go (6 hunks)
  • cmd/upgrade.go (1 hunks)
  • cmd/upgrade_test.go (2 hunks)
  • cmd/version.go (3 hunks)
  • cmd/version_test.go (7 hunks)
  • development.md (1 hunks)
  • fiber/main.go (1 hunks)

Walkthrough

This update introduces a migration framework and command to automate codebase upgrades between Fiber versions. It adds new migration functions, test coverage for these, and refactors error handling, resource management, and code formatting throughout the CLI and supporting files. Documentation, templates, and ignore lists are also modernized for consistency and clarity.

Changes

File(s) / Group Change Summary
.github/CODE_OF_CONDUCT.md, .github/CONTRIBUTING.md, .github/ISSUE_TEMPLATE/..., .github/pull_request_template.md, README.md Improved markdown formatting, heading consistency, and link presentation in documentation and templates.
.gitignore Expanded ignore patterns for test artifacts, IDE files, and dependency directories.
Makefile Introduced new Makefile with common Go project targets (test, lint, coverage, etc.).
development.md Added new development guide for local setup using air tool.
cmd/dev.go, cmd/dev_test.go Refactored error handling, resource cleanup, and concurrency; modernized test code and assertions.
cmd/helpers.go, cmd/helpers_test.go Improved error propagation, resource management, and test parallelism; updated JSON helpers and file handling.
cmd/internal/cmd.go, cmd/internal/helpers.go, cmd/internal/prompt.go, cmd/internal/prompt_test.go, cmd/internal/task.go Refactored for better error handling, struct field order, method renaming, and test assertion style.
cmd/internal/migrations/common.go, cmd/internal/migrations/lists.go, cmd/internal/migrations/v3/common.go, cmd/internal/migrations/v3/common_test.go New migration framework: Added migration functions for upgrading Fiber code, versioned migration lists, and comprehensive tests for migration logic.
cmd/migrate.go, cmd/root.go Added new migrate CLI command; registered it in root command; improved error handling and version checking logic.
cmd/new.go, cmd/new_test.go Enhanced error handling and explicit returns; switched to require for test assertions.
cmd/root_test.go, cmd/upgrade.go, cmd/upgrade_test.go, cmd/version.go, cmd/version_test.go, cmd/tester_test.go Refactored for improved error handling, naming consistency, and test robustness; split version retrieval into separate functions with better HTTP handling.
fiber/main.go Changed import style to multi-line block; no logic changes.

Sequence Diagram(s)

Migration Command Flow

sequenceDiagram
    participant User
    participant CLI
    participant Migrations
    participant MigrationFns

    User->>CLI: fiber migrate --to X.Y.Z
    CLI->>CLI: Parse and validate target version
    CLI->>Migrations: DoMigration(cmd, cwd, curr, target)
    loop For each Migration in Migrations
        Migrations->>Migrations: Check version constraints
        alt Constraints match
            Migrations->>MigrationFns: Run migration functions
        else Constraints don't match
            Migrations->>CLI: Print skip message
        end
    end
    Migrations->>CLI: Return success/failure
    CLI->>User: Print migration result
Loading

Migration Function File Transformation

sequenceDiagram
    participant MigrationFn
    participant FileSystem

    MigrationFn->>FileSystem: Walk directory tree
    loop For each Go file (excluding vendor)
        FileSystem->>MigrationFn: Read file content
        MigrationFn->>MigrationFn: Apply string/regex replacements
        MigrationFn->>FileSystem: Write updated content
    end
    MigrationFn->>CLI: Print migration status
Loading

Possibly related PRs

Poem

🐇
Hop, hop! The code’s anew,
Migrations guide us, version through.
Helpers fixed, errors caught—
Tests now fail if bugs are sought.
With Makefile fresh and docs in tow,
This bunny’s proud to see us grow!
🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-migration-command

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ReneWerner87 ReneWerner87 marked this pull request as ready for review July 12, 2025 20:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (10)
.github/CONTRIBUTING.md (2)

7-8: Typo in heading: “Comits” → “Commits”
Small but visible typo in a prominent section header.

-## Pull Requests or Comits
+## Pull Requests or Commits

11-12: Grammar tweak for clarity
Current sentence is awkward. Suggest re-phrasing.

-Titles always we must use prefix according to below:
+Pull-request titles must always start with one of the following prefixes:
README.md (2)

1-3: Prefer a more descriptive top-level heading

The current # cli heading is terse and doesn’t identify which CLI the document covers. Consider changing it to something like # Fiber CLI (or similar) so the README is self-explanatory when viewed out of context (e.g., in search results or aggregated docs).

-# cli
+# Fiber CLI

15-18: Fix heading hierarchy for sub-commands

## fiber, ## fiber dev, ## fiber new, etc. are currently at the same level as ## Commands, which breaks the Markdown outline.
Drop them one level (###) so they nest correctly under Commands; this improves navigation in rendered TOCs.

-## fiber
+### fiber
@@
-## fiber dev
+### fiber dev
@@
-## fiber new
+### fiber new
@@
-## fiber upgrade
+### fiber upgrade
@@
-## fiber version
+### fiber version

Also applies to: 33-35, 64-66, 104-108, 120-124

.github/pull_request_template.md (1)

13-13: Minor wording tweak

“Check out the emoji cheatsheet here” is redundant with the explicit link.
Dropping “here” makes the sentence tighter.

-Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: [https://gitmoji.carloscuesta.me](https://gitmoji.carloscuesta.me)
+Use emojis in commit messages to make the intent obvious. See the emoji cheatsheet: [https://gitmoji.carloscuesta.me](https://gitmoji.carloscuesta.me)
development.md (1)

1-21: Documentation is clear and helpful for local development setup.

The development guide provides practical instructions for setting up live recompilation with air. The workflow is logical: install tool → configure for project → test the result.

Consider adding a brief explanation of what air does for developers who might be unfamiliar with the tool.

# Local Development

+This guide helps you set up a live-reload development environment using [air](https://github.com/cosmtrek/air), which automatically rebuilds and reinstalls the CLI when source files change.
+
Install [air](https://github.com/cosmtrek/air)
cmd/internal/migrations/common.go (2)

16-16: Consider making the regex more robust.

The current regex (github\.com\/gofiber\/fiber\/)(v\d+)( *?)(v[\w.-]+) may not handle all edge cases in go.mod files. Consider these potential improvements:

-var pkgRegex = regexp.MustCompile(`(github\.com\/gofiber\/fiber\/)(v\d+)( *?)(v[\w.-]+)`)
+var pkgRegex = regexp.MustCompile(`(github\.com/gofiber/fiber/)(v\d+)(\s+)(v[\w.-]+(?:-[\w.-]+)*)`)

This version:

  • Removes unnecessary escaping of forward slashes
  • Uses \s+ for more flexible whitespace matching
  • Improves version pattern to handle pre-release versions better

53-53: Fix misleading comment.

The comment "update go.mod file" is incorrect - this line is about updating source files, not go.mod.

-		// update go.mod file
+		// write updated source file
cmd/migrate.go (1)

16-26: Consider avoiding panic in init function.

Using panic in the init function can make the application hard to debug. Consider handling the error more gracefully.

 func init() {
 	latestFiberVersion, err := LatestFiberVersion()
 	if err != nil {
 		latestFiberVersion = ""
 	}

 	migrateCmd.Flags().StringVarP(&targetVersionS, "to", "t", "", "Migrate to a specific version e.g:"+latestFiberVersion+" Format: X.Y.Z")
-	if err := migrateCmd.MarkFlagRequired("to"); err != nil {
-		panic(err)
-	}
+	_ = migrateCmd.MarkFlagRequired("to") // This should never fail with valid flag names
 }
Makefile (1)

1-65: Excellent development workflow automation!

The Makefile provides comprehensive coverage of development tasks with modern Go tooling. The targets are well-organized and include helpful descriptions.

The static analysis hints about missing all and clean targets are conventional suggestions but not critical for this CLI project's workflow.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39f8a57 and b136398.

⛔ Files ignored due to path filters (9)
  • .github/release-drafter.yml is excluded by !**/*.yml
  • .github/workflows/linter.yml is excluded by !**/*.yml
  • .github/workflows/markdown.yml is excluded by !**/*.yml
  • .github/workflows/security.yml is excluded by !**/*.yml
  • .github/workflows/vulncheck.yml is excluded by !**/*.yml
  • .golangci.yml is excluded by !**/*.yml
  • .markdownlint.yml is excluded by !**/*.yml
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (34)
  • .github/CODE_OF_CONDUCT.md (1 hunks)
  • .github/CONTRIBUTING.md (2 hunks)
  • .github/ISSUE_TEMPLATE/---bug.md (1 hunks)
  • .github/ISSUE_TEMPLATE/---feature.md (1 hunks)
  • .github/ISSUE_TEMPLATE/---question.md (1 hunks)
  • .github/pull_request_template.md (1 hunks)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • README.md (3 hunks)
  • cmd/dev.go (11 hunks)
  • cmd/dev_test.go (11 hunks)
  • cmd/helpers.go (3 hunks)
  • cmd/helpers_test.go (3 hunks)
  • cmd/internal/cmd.go (4 hunks)
  • cmd/internal/helpers.go (2 hunks)
  • cmd/internal/migrations/common.go (1 hunks)
  • cmd/internal/migrations/lists.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (1 hunks)
  • cmd/internal/migrations/v3/common_test.go (1 hunks)
  • cmd/internal/prompt.go (3 hunks)
  • cmd/internal/prompt_test.go (3 hunks)
  • cmd/internal/task.go (3 hunks)
  • cmd/migrate.go (1 hunks)
  • cmd/new.go (2 hunks)
  • cmd/new_test.go (2 hunks)
  • cmd/root.go (4 hunks)
  • cmd/root_test.go (7 hunks)
  • cmd/tester_test.go (6 hunks)
  • cmd/upgrade.go (1 hunks)
  • cmd/upgrade_test.go (2 hunks)
  • cmd/version.go (3 hunks)
  • cmd/version_test.go (7 hunks)
  • development.md (1 hunks)
  • fiber/main.go (1 hunks)
🧰 Additional context used
🧠 Learnings (20)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
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/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/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:21:18.705Z
Learning: It's decided to implement the fluent concept for methods `Status` and `Type` in the Fiber framework using generics, as per the articles provided.
fiber/main.go (6)
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: 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.
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.
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.
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.
development.md (10)
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: 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.
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.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: SadikSunbul
PR: gofiber/recipes#2797
File: email-verification/infrastructure/email/smtp.go:22-22
Timestamp: 2025-02-07T10:16:46.994Z
Learning: In the gofiber/recipes repository, which contains example implementations and recipes, it's acceptable to have credentials directly in the code for demonstration purposes since these are meant to be educational examples rather than production code.
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.
Learnt from: SadikSunbul
PR: gofiber/recipes#2797
File: email-verification/main.go:26-31
Timestamp: 2025-02-07T10:18:09.439Z
Learning: In the gofiber/recipes repository, recipes should focus on demonstrating specific features clearly without production-level configurations like advanced error handling, graceful shutdown, or security middleware, as they are meant to be educational examples.
README.md (10)
Learnt from: hcancelik
PR: gofiber/fiber#3036
File: docs/middleware/cache.md:103-103
Timestamp: 2024-06-15T19:26:06.401Z
Learning: There are no hard tabs in the lines 100 to 105 of the `docs/middleware/cache.md` file. Future comments about formatting should accurately reflect the actual content.
Learnt from: hcancelik
PR: gofiber/fiber#3036
File: docs/middleware/cache.md:103-103
Timestamp: 2024-10-08T19:06:06.583Z
Learning: There are no hard tabs in the lines 100 to 105 of the `docs/middleware/cache.md` file. Future comments about formatting should accurately reflect the actual content.
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.
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.
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/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: 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.
Learnt from: SadikSunbul
PR: gofiber/recipes#2797
File: email-verification/main.go:26-31
Timestamp: 2025-02-07T10:18:09.439Z
Learning: In the gofiber/recipes repository, recipes should focus on demonstrating specific features clearly without production-level configurations like advanced error handling, graceful shutdown, or security middleware, as they are meant to be educational examples.
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.
cmd/internal/prompt_test.go (5)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
cmd/upgrade_test.go (6)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
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#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
cmd/new_test.go (9)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
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: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
Learnt from: mdelapenya
PR: gofiber/storage#1665
File: cassandra/cassandra_test.go:35-38
Timestamp: 2025-04-20T23:52:03.362Z
Learning: In testcontainers-go, calling `testcontainers.CleanupContainer(t, c)` before checking the error from container creation is safe due to the implementation details of the library. The CleanupContainer function handles nil or partially initialized containers gracefully.
cmd/root_test.go (6)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
cmd/version_test.go (11)
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: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
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.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
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.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
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.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-21T11:28:14.554Z
Learning: Using `fiber.Ctx`, even when wrapped, does not achieve version independence, as it still relies on the specific Fiber implementation.
cmd/helpers_test.go (13)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-06-30T00:38:06.580Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
Learnt from: gaby
PR: gofiber/fiber#3056
File: middleware/encryptcookie/utils.go:22-25
Timestamp: 2024-07-02T13:29:56.992Z
Learning: The `encryptcookie_test.go` file contains unit tests that validate key lengths for both `EncryptCookie` and `DecryptCookie` functions, ensuring that invalid key lengths raise appropriate errors.
Learnt from: gaby
PR: gofiber/fiber#3056
File: middleware/encryptcookie/utils.go:22-25
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The `encryptcookie_test.go` file contains unit tests that validate key lengths for both `EncryptCookie` and `DecryptCookie` functions, ensuring that invalid key lengths raise appropriate errors.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/middleware_test.go:190-191
Timestamp: 2024-09-25T17:05:06.991Z
Learning: When testing session `IdleTimeout` expiration, it's acceptable to use `time.Sleep` to simulate the passage of time in tests.
Learnt from: sixcolors
PR: gofiber/fiber#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.
Learnt from: mdelapenya
PR: gofiber/storage#1665
File: cassandra/cassandra_test.go:35-38
Timestamp: 2025-04-20T23:52:03.362Z
Learning: In testcontainers-go, calling `testcontainers.CleanupContainer(t, c)` before checking the error from container creation is safe due to the implementation details of the library. The CleanupContainer function handles nil or partially initialized containers gracefully.
.github/CONTRIBUTING.md (5)
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: hcancelik
PR: gofiber/fiber#3036
File: docs/middleware/cache.md:103-103
Timestamp: 2024-10-08T19:06:06.583Z
Learning: There are no hard tabs in the lines 100 to 105 of the `docs/middleware/cache.md` file. Future comments about formatting should accurately reflect the actual content.
Learnt from: hcancelik
PR: gofiber/fiber#3036
File: docs/middleware/cache.md:103-103
Timestamp: 2024-06-15T19:26:06.401Z
Learning: There are no hard tabs in the lines 100 to 105 of the `docs/middleware/cache.md` file. Future comments about formatting should accurately reflect the actual content.
Learnt from: SadikSunbul
PR: gofiber/recipes#2797
File: email-verification/main.go:26-31
Timestamp: 2025-02-07T10:18:09.439Z
Learning: In the gofiber/recipes repository, recipes should focus on demonstrating specific features clearly without production-level configurations like advanced error handling, graceful shutdown, or security middleware, as they are meant to be educational examples.
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`.
cmd/migrate.go (1)
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`.
cmd/root.go (1)
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/main.go:0-0
Timestamp: 2024-11-23T19:34:59.534Z
Learning: In this codebase, `NewConfiguration()` reads environment variables with defaults and cannot fail, so error handling for it is unnecessary.
Makefile (2)
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`.
cmd/version.go (6)
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.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
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: 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.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-21T11:28:14.554Z
Learning: Using `fiber.Ctx`, even when wrapped, does not achieve version independence, as it still relies on the specific Fiber implementation.
cmd/internal/migrations/v3/common_test.go (12)
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: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-06-30T00:38:06.580Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
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.
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.
cmd/internal/migrations/v3/common.go (4)
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: 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.
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.
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.
cmd/tester_test.go (10)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: mdelapenya
PR: gofiber/storage#1665
File: cassandra/cassandra_test.go:35-38
Timestamp: 2025-04-20T23:52:03.362Z
Learning: In testcontainers-go, calling `testcontainers.CleanupContainer(t, c)` before checking the error from container creation is safe due to the implementation details of the library. The CleanupContainer function handles nil or partially initialized containers gracefully.
Learnt from: efectn
PR: gofiber/fiber#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.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/middleware_test.go:190-191
Timestamp: 2024-09-25T17:05:06.991Z
Learning: When testing session `IdleTimeout` expiration, it's acceptable to use `time.Sleep` to simulate the passage of time in tests.
Learnt from: sixcolors
PR: gofiber/fiber#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.
cmd/dev_test.go (10)
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
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: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
Learnt from: gaby
PR: gofiber/fiber#3170
File: ctx_test.go:1721-1724
Timestamp: 2024-10-16T12:12:30.506Z
Learning: In the Go unit tests in `ctx_test.go`, it is acceptable to use invalid CIDR notation such as `"0.0.0.1/31junk"` for testing purposes.
Learnt from: mdelapenya
PR: gofiber/storage#1665
File: cassandra/cassandra_test.go:35-38
Timestamp: 2025-04-20T23:52:03.362Z
Learning: In testcontainers-go, calling `testcontainers.CleanupContainer(t, c)` before checking the error from container creation is safe due to the implementation details of the library. The CleanupContainer function handles nil or partially initialized containers gracefully.
cmd/dev.go (2)
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.
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.
🧬 Code Graph Analysis (8)
cmd/upgrade.go (1)
cmd/version.go (1)
  • LatestCliVersion (65-67)
cmd/internal/prompt_test.go (1)
cmd/internal/prompt.go (1)
  • NewPrompt (22-35)
cmd/version_test.go (1)
cmd/version.go (1)
  • LatestFiberVersion (61-63)
cmd/internal/migrations/common.go (1)
cmd/internal/helpers.go (1)
  • ChangeFileContent (33-65)
cmd/migrate.go (2)
cmd/version.go (1)
  • LatestFiberVersion (61-63)
cmd/internal/migrations/lists.go (1)
  • DoMigration (41-64)
cmd/root.go (1)
cmd/version.go (1)
  • LatestCliVersion (65-67)
cmd/internal/migrations/v3/common.go (1)
cmd/internal/helpers.go (1)
  • ChangeFileContent (33-65)
cmd/internal/migrations/lists.go (2)
cmd/internal/migrations/v3/common.go (4)
  • MigrateHandlerSignatures (14-27)
  • MigrateParserMethods (30-47)
  • MigrateRedirectMethods (50-67)
  • MigrateGenericHelpers (70-92)
cmd/internal/migrations/common.go (1)
  • MigrateGoPkgs (18-52)
🪛 checkmake (0.2.2)
Makefile

[warning] 61-61: Missing required phony target "all"

(minphony)


[warning] 61-61: Missing required phony target "clean"

(minphony)

🔇 Additional comments (102)
.github/ISSUE_TEMPLATE/---bug.md (1)

10-10: Consistent heading style looks good
Switching from bold text to a level-2 heading brings this template in line with the others and improves Markdown semantics. ✔️

.github/ISSUE_TEMPLATE/---question.md (1)

10-10: Heading upgrade approved
Same positive effect here—uniform heading hierarchy across issue templates.

.github/ISSUE_TEMPLATE/---feature.md (1)

10-16: All four section headers upgraded – nice consistency win
No functional impact; readability is better.

.github/CODE_OF_CONDUCT.md (1)

74-82: Link conversion improves usability
Replacing raw URLs with Markdown links is purely beneficial; no issues spotted.

.github/CONTRIBUTING.md (1)

22-22: Heading level now consistent, good
Changing “👍 Contribute” to ## matches the rest of the document hierarchy.

fiber/main.go (1)

3-5: LGTM! Import formatting improvement follows Go conventions.

Converting to multi-line import format is a good practice that makes future import additions cleaner and aligns with standard Go formatting conventions.

cmd/upgrade.go (1)

21-21: LGTM! Function call update aligns with API refactoring.

The change from latestVersion(true) to LatestCliVersion() improves code clarity by using a more descriptive function name and eliminates the boolean parameter, making the API cleaner and more type-safe.

cmd/internal/prompt_test.go (3)

9-9: LGTM! Added require import for improved test assertions.

Adding the require package import supports the enhanced error checking patterns used in the updated test assertions.


30-30: LGTM! Improved error assertions using require.Error.

Replacing assert.NotNil with require.Error is more appropriate for error checking as it:

  • Ensures tests fail immediately if expected errors are absent
  • Makes test intent clearer (checking for error presence vs. non-nil values)
  • Follows project conventions for using require in critical assertions

Also applies to: 38-38


71-71: LGTM! Proper error state validation using require.Error.

Using require.Error(t, p.err) correctly validates that the prompt's error state is set after receiving an error message, ensuring the test fails immediately if the error handling is broken.

cmd/upgrade_test.go (3)

11-11: LGTM! Added require import for enhanced test assertions.

Adding the require package supports the improved error checking patterns used throughout the test function.


24-24: LGTM! Corrected variable naming to follow Go conventions.

Changing latestCliVersionUrl to latestCliVersionURL follows Go naming conventions where acronyms should be uppercase. This improves code consistency across the codebase.

Also applies to: 28-28, 37-37


26-26: LGTM! Enhanced error assertions using require methods.

The changes from assert.NotNil/assert.Nil to require.Error/require.NoError improve test reliability by:

  • Ensuring immediate test failure on critical assertion failures
  • Making test intent clearer (checking error presence/absence vs. nil values)
  • Following project conventions for using require in critical test scenarios

Also applies to: 33-33, 41-41

cmd/new_test.go (2)

8-8: LGTM: Required import added for improved test assertions.

The addition of the require import supports the transition to stricter error checking in tests.


16-17: Excellent: Improved test reliability with require assertions.

The consistent replacement of assert with require for error checking follows the project's testing standards and ensures tests fail immediately on critical errors rather than continuing execution. This is particularly important for cleanup operations and fundamental test validations.

Also applies to: 25-25, 31-32, 40-40, 46-47, 54-54, 60-61, 69-69, 76-76, 82-82, 90-90, 101-101

cmd/internal/prompt.go (4)

16-16: LGTM: Struct field reordering for better organization.

The field reordering improves the logical structure of the Prompt struct.

Also applies to: 19-19


25-25: Good: Updated to use current bubbles API.

The change from input.NewModel() to input.New() aligns with the updated bubbles library API.


56-56: Excellent: Enhanced error context for better debugging.

The error wrapping with descriptive context ("check console:" and "run prompt:") significantly improves error traceability and debugging experience.

Also applies to: 60-60


84-86: Good: Defensive programming with explicit default case.

Adding the default case with a comment to explicitly ignore other keys improves code clarity and follows defensive programming practices.

cmd/root_test.go (6)

14-14: LGTM: Required import for improved assertions.

The addition supports the transition to stricter error checking in tests.


26-26: Good: Simplified error creation.

Using errors.New() instead of fmt.Errorf() for simple error messages is more appropriate and efficient.


40-40: Excellent: More explicit error assertion.

Changing from assert.Nil(err) to require.Error(err) makes the test intention clearer and provides immediate test failure on critical errors.


86-86: Good: Consistent naming convention.

The rename from latestCliVersionUrl to latestCliVersionURL follows Go naming conventions where acronyms should be capitalized.

Also applies to: 100-100


118-118: Excellent: Proper test helper marking.

Adding t.Helper() to the test helper function improves test failure reporting by showing the correct file and line number when failures occur.


128-128: LGTM: Variable renamed for consistency.

The variable name update maintains consistency with the constant renaming.

.gitignore (1)

1-32: Excellent: Comprehensive .gitignore expansion.

The extensive additions to .gitignore provide thorough coverage of:

  • Build artifacts and test binaries (including compressed formats)
  • Profiling files and workspace files
  • IDE metadata for common editors
  • Multiple vendor directory patterns
  • Clear organization with descriptive comments

This comprehensive approach ensures proper exclusion of development artifacts and aligns well with the expanded development workflow.

cmd/internal/task.go (5)

15-15: LGTM: Improved struct field organization.

The field reordering enhances the logical structure of the SpinnerTask struct.

Also applies to: 17-18


22-22: Good: Updated to current spinner API.

The change from spinner.NewModel() to spinner.New() aligns with the updated bubbles library API, consistent with similar changes in prompt.go.


39-40: Excellent: Improved message type naming and consistency.

The rename from finishedMsg to finishedError makes the message type more explicit and aligns with similar improvements across internal UI components.

Also applies to: 54-55


48-48: Good: Enhanced error formatting and context.

The improved error messages provide better context for debugging, particularly the "run spinner:" prefix that aids in error traceability.

Also applies to: 84-84


83-83: LGTM: Updated to use Run() method.

The change from Start() to Run() follows the tea library API evolution and maintains consistency with similar changes in prompt.go.

cmd/version_test.go (5)

11-11: Good addition of require import for stricter error handling.

Adding the require package import aligns with the project's preference for using require methods for error assertions in tests, as noted in the retrieved learnings.


20-20: Good fix: Corrected variable naming convention.

The rename from latestVersionUrl to latestVersionURL follows Go naming conventions where acronyms should be all uppercase.

Also applies to: 31-31, 118-118, 128-128, 139-139


23-23: Excellent improvement: Enhanced error handling with require.

Switching from assert.NoError/assert.Error to require.NoError/require.Error ensures tests fail immediately on error conditions rather than continuing execution. This aligns perfectly with the project's testing preferences.

Also applies to: 34-34, 47-47, 62-62, 78-78, 93-93, 121-121, 131-131, 142-142


100-103: Good modernization: Replaced deprecated ioutil.WriteFile.

The switch from ioutil.WriteFile to os.WriteFile with explicit error handling is correct. The panic on error is appropriate for test setup functions where failure should be fatal.


120-120: Correctly updated API calls to match refactored version functions.

The change from latestVersion(false) to LatestFiberVersion() properly reflects the API refactoring in cmd/version.go where the functions were split into more specific methods.

Also applies to: 130-130, 141-141

cmd/internal/migrations/common.go (1)

18-29: LGTM: Good error handling and clear logic for package migration.

The string replacer approach for updating import paths is efficient and the error wrapping provides good context for debugging.

cmd/helpers_test.go (5)

32-32: Good addition of parallel test execution.

Adding t.Parallel() to tests improves test execution time and follows Go testing best practices.

Also applies to: 39-39


41-41: Excellent modernization: Replaced deprecated ioutil functions.

The migration from ioutil.TempDir/ioutil.TempFile to os.MkdirTemp/os.CreateTemp removes dependency on the deprecated ioutil package.

Also applies to: 47-47


42-42: Perfect: Enhanced error handling with require.

Consistently switching from assert to require for error checks ensures tests fail immediately on errors, preventing cascading failures. This aligns with the project's testing preferences noted in the retrieved learnings.

Also applies to: 44-44, 48-52, 56-56, 71-72, 74-75, 76-76, 83-83


70-70: Good security practice: Added filepath.Clean.

Using filepath.Clean on the filename before file creation is a good security practice to prevent path traversal issues.


80-84: Good improvement: Renamed test and fixed logic.

The test rename to Test_Helper_StoreJSON follows Go naming conventions, and correctly expecting an error when storing a complex number is the right behavior.

cmd/migrate.go (3)

34-50: Excellent version validation logic.

The version parsing and validation is robust:

  • Properly handles version prefixes
  • Uses semantic version comparison
  • Provides clear error messages
  • Prevents downgrades

52-61: Good integration with migration framework.

The integration with migrations.DoMigration is clean and the error handling provides good context for debugging migration failures.


62-65: Nice touch: Colored success output.

Using termenv for colored output provides a good user experience for successful migrations.

cmd/internal/helpers.go (3)

15-15: Good improvement: Clearer type naming.

Renaming from finishedMsg to finishedError better reflects the type's purpose as an error wrapper.


24-29: Enhanced error handling in checkConsole.

The addition of error wrapping provides better context for console size retrieval failures.


33-65: Well-implemented file processing utility.

The ChangeFileContent function is well-designed with several good practices:

  • Skips vendor directories (line 40-42)
  • Filters for Go files only (line 45-47)
  • Uses secure file permissions (0o600)
  • Comprehensive error wrapping
  • Proper use of filepath.Walk

The #nosec G304 comment is appropriate since the path comes from controlled directory traversal.

cmd/root.go (5)

13-20: Good organization and initialization.

The constant grouping and root config initialization are well-structured.


29-29: Migration command successfully integrated.

The addition of migrateCmd properly integrates the new migration functionality into the CLI.


53-53: Improved error context wrapping.

The error wrapping with "help:" context provides better error information to users.


72-72: Version API update aligns with refactoring.

The change from latestVersion(true) to LatestCliVersion() correctly uses the new API from cmd/version.go.


99-103: Enhanced error handling for config storage.

The improved error handling properly logs failures from storeConfig() and handles potential print errors gracefully.

cmd/dev_test.go (7)

6-6: Good modernization of imports.

Replacing deprecated ioutil with io aligns with modern Go practices.


19-19: Excellent addition of require for stricter assertions.

Adding require import enables immediate test failure on critical errors, improving test reliability.


34-34: Improved test robustness with require.NoError.

Replacing assert.NoError with require.NoError for critical operations ensures tests fail immediately on errors, preventing cascading failures and providing clearer test results.

Also applies to: 39-39, 51-51, 53-53, 63-63, 74-74, 89-89, 125-126, 133-133, 135-135, 150-150


50-50: Modernized file/directory operations.

The migration from deprecated ioutil.TempDir/ioutil.TempFile to os.MkdirTemp/os.CreateTemp follows current Go best practices.

Also applies to: 132-132, 138-138, 141-141, 144-144, 148-148


76-76: Updated to modern io package.

Replacing ioutil.NopCloser with io.NopCloser aligns with the deprecation of the ioutil package.


122-122: Channel buffer adjustment improves test reliability.

Increasing the buffer size to 2 prevents potential blocking in the test scenario.


249-249: Excellent addition of subtest parallelization.

Adding t.Parallel() to subtests improves test execution speed and ensures proper isolation.

Also applies to: 271-271, 293-293

cmd/version.go (5)

33-33: API update aligns with refactoring.

The change to LatestFiberVersion() correctly uses the new separated API.


41-44: Good variable organization.

Grouping related variables improves code readability.


47-49: Modernized file reading with error wrapping.

The migration from ioutil.ReadFile to os.ReadFile with descriptive error wrapping improves both modernization and debugging.


61-67: Excellent API separation.

Splitting the single latestVersion function into LatestFiberVersion and LatestCliVersion improves code clarity and eliminates the boolean parameter pattern.


69-105: Significantly improved HTTP handling and resource management.

The new implementation includes:

  • Context with timeout to prevent hanging requests
  • Explicit request creation with context
  • Proper error wrapping for better debugging
  • Safe resource cleanup with error handling
  • Modern io.ReadAll usage

These improvements make the HTTP operations more robust and maintainable.

cmd/new.go (6)

40-43: Improved error handling for working directory.

The explicit error handling with wrapping provides better context when os.Getwd() fails.


46-48: Enhanced project creation and cleanup error handling.

The explicit error propagation and improved cleanup logging ensure better error visibility and resource management.

Also applies to: 51-53


72-81: Excellent refactoring of createProject function.

The function now returns explicit errors with proper wrapping instead of using named returns, making the error handling clearer and more maintainable.


84-90: Consistent error handling in createBasic.

The explicit error returns maintain consistency with the overall error handling improvements.


92-95: Good constant organization.

Grouping related constants improves code readability and maintainability.


99-123: Comprehensive error handling in createComplex.

The function now properly handles and returns errors at each step, with consistent error wrapping and explicit returns. This greatly improves the reliability and debuggability of the complex project creation flow.

cmd/internal/migrations/v3/common_test.go (4)

36-56: Well-structured test for handler signature migration.

The test properly validates the migration from pointer to value receivers for fiber.Ctx, uses parallel execution, and includes proper cleanup.


58-87: Comprehensive test coverage for parser method migrations.

The test validates all four parser method transformations to the new Bind() API correctly.


89-115: Complete test coverage for redirect method migrations.

The test properly validates all redirect method transformations to the new fluent API.


117-145: Thorough test for generic helper migrations.

The test validates all helper function transformations to use generics, covering int, float64, and bool types appropriately.

cmd/internal/cmd.go (5)

17-29: Good struct field organization.

The reordering groups related fields together, improving code readability and maintainability.


54-54: Good method naming to avoid confusion with Go's init().

Renaming the method from init() to start() prevents confusion with Go's built-in init function.

Also applies to: 57-73


59-72: Excellent error handling improvements.

The changes include:

  • Sequential error checking prevents resource leaks
  • Error wrapping provides better context for debugging
  • Pipe close errors are properly captured and reported

Also applies to: 141-146, 161-166


61-61: Better semantic naming for error message type.

Renaming finishedMsg to finishedError clearly indicates this type carries error information.

Also applies to: 67-67, 71-71, 85-88


32-32: Spinner initialization uses the correct new API

The change from spinner.NewModel() to spinner.New() aligns with the latest github.com/charmbracelet/bubbles/spinner package, where NewModel() has been deprecated in favor of the more concise New() constructor. No further action is required.

cmd/tester_test.go (3)

19-19: Excellent test exit control implementation.

The testExit variable allows controlled exit behavior during tests, preventing abrupt termination. The return statements after testExit calls ensure proper test flow control.

Also applies to: 50-52, 56-58, 60-60, 94-94, 99-99


115-117: Good modernization by replacing deprecated ioutil.

Replacing ioutil.TempDir with os.MkdirTemp follows Go's recommendation to use the os package directly.


122-125: Better error visibility in cleanup.

Logging directory removal failures helps with test debugging instead of silently ignoring errors.

cmd/dev.go (4)

45-48: Good use of constants for OS names.

Using windowsOS constant prevents typos and improves maintainability.

Also applies to: 165-165, 316-316


106-109: Excellent error handling and resource management improvements.

The changes include:

  • Proper error wrapping with context
  • Cleanup error logging for debugging
  • Sequential error checking to prevent resource leaks
  • Explicit file closure with error checking

Also applies to: 114-119, 141-178


254-258: Safer concurrency handling and better error visibility.

The improvements include:

  • Safe type assertion for atomic.Value
  • Error logging for pipe operations and io.Copy failures
  • Process wait error handling
    These changes make concurrent operations more robust and debuggable.

Also applies to: 301-308, 320-322, 337-341, 347-351


429-442: Thorough error handling for buffer operations.

While buffer write operations to a local bytes.Buffer rarely fail, the explicit error checking is consistent with the PR's comprehensive error handling approach.

cmd/internal/migrations/v3/common.go (4)

14-27: Correct implementation of handler signature migration.

The function properly migrates from pointer receivers (*fiber.Ctx) to value receivers (fiber.Ctx), aligning with Fiber v3's breaking changes.


29-47: Comprehensive parser method migration.

The function correctly maps all parser methods to the new Bind() API:

  • BodyParser → Bind().Body
  • CookieParser → Bind().Cookie
  • ParamsParser → Bind().URI
  • QueryParser → Bind().Query

49-67: Well-implemented redirect method migration.

The function correctly handles all redirect methods with appropriate use of regex for .Redirect( to avoid conflicts with other redirect methods.


69-92: Excellent generic helper migration using regex.

The function correctly transforms helper methods to use generics with proper type mappings:

  • ParamsInt → Params[int]
  • QueryInt → Query[int]
  • QueryFloat → Query[float64]
  • QueryBool → Query[bool]

The regex patterns properly capture variable names for the transformation.

cmd/internal/migrations/lists.go (2)

3-10: LGTM! Clean imports and package structure.

The imports are well-organized with proper grouping (standard library, external packages, internal packages) and the package structure follows Go conventions.


12-20: LGTM! Well-defined types with clear purpose.

The MigrationFn type signature is appropriate for migration functions, providing all necessary context (command, working directory, current and target versions). The Migration struct is simple and effective with semantic version constraints as strings.

cmd/helpers.go (9)

25-29: LGTM! Improved error handling in init function.

The change to only assign homeDir when no error occurs is a good defensive programming practice, preventing potential issues with invalid directory paths.


37-49: LGTM! Enhanced error handling and resource management.

The improvements to stderr pipe handling are excellent:

  • Proper error wrapping with context
  • Deferred cleanup with error logging
  • Goroutine for non-blocking output copying with error handling

This pattern ensures robust pipe management without blocking the main execution flow.


51-63: LGTM! Consistent stdout pipe improvements.

The stdout pipe handling mirrors the stderr improvements with the same robust patterns:

  • Contextual error wrapping
  • Proper resource cleanup
  • Non-blocking output copying

This consistency makes the code maintainable and reliable.


65-70: LGTM! Improved command execution error handling.

The error wrapping for command execution provides valuable context about which command failed, making debugging easier. The explicit return of the error is cleaner than the previous implicit approach.


73-87: LGTM! Enhanced error handling in replace function.

The improvements include:

  • Proper error wrapping for filepath.Walk failures
  • Consistent error handling pattern
  • Clear function signature with better parameter naming

The error context will help diagnose issues during file replacements.


89-109: LGTM! Improved file operations with better error context.

The replaceWalkFn improvements are solid:

  • Contextual error wrapping for pattern matching, file reading, and writing
  • Use of bytes.ReplaceAll for efficient byte-level replacements
  • Proper path cleaning for security
  • Clear variable naming

The error messages will help identify specific failure points in the replacement process.


111-128: LGTM! Robust file creation with proper resource management.

The createFile function improvements include:

  • Contextual error wrapping for file operations
  • Proper deferred cleanup with error logging
  • Path cleaning for security
  • Clear error propagation

This follows Go best practices for file handling and resource management.


147-157: LGTM! Improved config function error handling.

The changes to loadConfig and storeConfig provide proper error propagation instead of silently ignoring errors. This is essential for reliable configuration management.


174-197: LGTM! Enhanced JSON functions with better naming and error handling.

The improvements to the JSON functions are excellent:

  • Function renaming to PascalCase (storeJSON, loadJSON) follows Go conventions for exported-style functions
  • Comprehensive error wrapping with context for marshal/unmarshal and file operations
  • Consistent error handling patterns
  • Proper return value handling

These changes make the JSON operations more robust and debuggable.

Copy link

@coderabbitai coderabbitai bot left a 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 (1)
cmd/internal/migrations/v3/common.go (1)

14-202: Consider documenting potential edge cases for string replacements.

While the migration functions work well for typical use cases, they may produce false positives when matching patterns inside string literals or across multi-line expressions. Consider adding a comment or documentation noting that users should review and test the migrated code.

Example edge cases:

  • String literals containing migration patterns (e.g., "Use *fiber.Ctx in handlers")
  • Multi-line method calls where arguments span multiple lines
  • Method calls with nested parentheses in arguments

These edge cases would typically result in compilation errors, making them easy to identify and fix manually.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a989589 and 79d26d2.

📒 Files selected for processing (3)
  • cmd/internal/migrations/lists.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (1 hunks)
  • cmd/internal/migrations/v3/common_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/internal/migrations/lists.go
  • cmd/internal/migrations/v3/common_test.go
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
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/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/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:21:18.705Z
Learning: It's decided to implement the fluent concept for methods `Status` and `Type` in the Fiber framework using generics, as per the articles provided.
cmd/internal/migrations/v3/common.go (3)
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: 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.
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.
🧬 Code Graph Analysis (1)
cmd/internal/migrations/v3/common.go (1)
cmd/internal/helpers.go (1)
  • ChangeFileContent (36-68)
⏰ 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: Build (1.24.x, windows-latest)
🔇 Additional comments (7)
cmd/internal/migrations/v3/common.go (7)

14-27: LGTM!

The function correctly migrates handler signatures from pointer receivers to value receivers, which aligns with the Fiber v3 API changes.


29-47: Clean implementation of parser method migrations.

The function efficiently migrates all parser methods to the new binding API using a single replacer.


49-67: Well-structured redirect method migration.

The function correctly handles the transformation order by first converting general .Redirect() calls to .Redirect().To(), then handling specific redirect methods.


69-92: Excellent use of regex capture groups for generic helper migration.

The function correctly preserves the context variable while transforming method calls to generic function calls with appropriate type parameters.


94-157: Simple and effective migrations for context methods, AllParams, Mount, and Router.Add.

These functions correctly implement straightforward API changes using string replacements with proper error handling.


173-189: Correct MIME constant migrations.

The function properly updates JavaScript MIME types from the application/ to text/ category, reflecting the correct content type standards.


191-202: LGTM!

Simple and effective migration of logger tag constants.

Copy link

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (1)
cmd/internal/migrations/v3/common.go (1)

146-158: Address the duplicate Add method migration issue mentioned in past review.

Based on past review comments, there appears to be duplication between MigrateAddMethod and MigrateRouterAddSignature functions performing the same transformation. The regex pattern here looks correct for wrapping the first parameter in a slice.

🧹 Nitpick comments (2)
cmd/internal/migrations/v3/common_test.go (1)

22-27: Consider adding validation for the #nosec comment.

The #nosec G304 comment suppresses a security warning for dynamic file paths. While this is acceptable in test code with controlled file paths, ensure this pattern isn't used in production code.

cmd/internal/migrations/v3/common.go (1)

1-339: Consider adding validation for semantic version parameters.

All migration functions accept fromVersion and toVersion parameters but don't use them. Consider adding validation to ensure migrations are only applied when appropriate, or remove unused parameters for clarity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79d26d2 and 4952b63.

📒 Files selected for processing (3)
  • cmd/internal/migrations/lists.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (1 hunks)
  • cmd/internal/migrations/v3/common_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/internal/migrations/lists.go
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
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/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/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:21:18.705Z
Learning: It's decided to implement the fluent concept for methods `Status` and `Type` in the Fiber framework using generics, as per the articles provided.
cmd/internal/migrations/v3/common_test.go (12)
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: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-06-30T00:38:06.580Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
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.
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.
cmd/internal/migrations/v3/common.go (8)
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: 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.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
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.
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.
Learnt from: ckoch786
PR: gofiber/fiber#3230
File: docs/whats_new.md:944-951
Timestamp: 2024-12-15T19:56:45.935Z
Learning: Detailed usage examples and explanations for new methods like `RemoveRoute` and `RemoveRouteByName` are documented in `docs/api/app.md`, so it's unnecessary to duplicate them in `docs/whats_new.md`.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-10-16T10:04:06.328Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
🧬 Code Graph Analysis (1)
cmd/internal/migrations/v3/common.go (1)
cmd/internal/helpers.go (1)
  • ChangeFileContent (36-68)
⏰ 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). (3)
  • GitHub Check: Build (1.24.x, windows-latest)
  • GitHub Check: lint
  • GitHub Check: Analyse
🔇 Additional comments (8)
cmd/internal/migrations/v3/common_test.go (4)

14-20: LGTM! Helper function follows best practices.

The helper function correctly uses t.Helper(), appropriate file permissions (0o600), and proper error handling with require.NoError.


36-56: Excellent test structure with comprehensive assertions.

The test properly validates both the file content transformations and the command output, ensuring the migration function works correctly end-to-end.


58-87: Test thoroughly covers parser method migrations.

Good coverage of all four parser methods being migrated. The assertions correctly verify the new binding API syntax.


294-317: Static routes test covers complex transformation logic.

The test validates both simple static route conversion and configuration migration including the IndexNames array transformation.

cmd/internal/migrations/v3/common.go (4)

15-28: LGTM! Simple and effective handler signature migration.

The string replacer approach is efficient for this straightforward transformation from pointer to value receivers.


162-189: Robust CORS configuration migration with proper error handling.

The nested conv function elegantly handles the string-to-slice transformation for CORS configuration fields. The regex patterns correctly capture the field values and the string splitting logic handles comma-separated values appropriately.


277-312: Complex static route migration handles multiple edge cases well.

The function properly handles different path patterns (/, *, custom paths) and configuration object transformations. The logic for converting Index to IndexNames array is particularly well-implemented.


70-93: Regex patterns verified as sufficient

I searched the codebase for any .ParamsInt, .QueryInt, .QueryFloat or .QueryBool calls on chained selectors or function-call results and found no occurrences:

  • No instances of )\s*\.(ParamsInt|QueryInt|QueryFloat|QueryBool)(
  • No multi-selector chains like obj.sub.ParamsInt(

All current usages are simple identifier receivers (e.g. ctx.ParamsInt(), so the (\w+) capture is adequate. No changes required here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
cmd/internal/migrations/v3/common.go (1)

246-259: Add fasthttp import when transforming proxy TLS configuration.

This migration introduces &fasthttp.Client{} but doesn't ensure the github.com/valyala/fasthttp import is present, which could cause compilation errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4952b63 and cc1b11c.

📒 Files selected for processing (3)
  • cmd/internal/migrations/lists.go (1 hunks)
  • cmd/internal/migrations/v3/common.go (1 hunks)
  • cmd/internal/migrations/v3/common_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/internal/migrations/lists.go
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
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/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/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:21:18.705Z
Learning: It's decided to implement the fluent concept for methods `Status` and `Type` in the Fiber framework using generics, as per the articles provided.
cmd/internal/migrations/v3/common_test.go (14)
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: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-10-08T19:06:06.583Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/db_mock.go:13-19
Timestamp: 2024-11-23T19:50:06.387Z
Learning: In test code within `clean-code/app/datasources/database/db_mock.go`, adding safety checks like context validation, safe type assertions, and extra documentation is not necessary.
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/datasources/database/memory_db_test.go:0-0
Timestamp: 2024-11-25T19:36:45.661Z
Learning: In the `clean-code/app/datasources/database/memory_db.go`, the in-memory database implementation is not intended for production use. Therefore, adding extensive tests for concurrency and error handling in `memory_db_test.go` is unnecessary.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-02T23:03:31.727Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-06-30T00:38:06.580Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: sixcolors
PR: gofiber/fiber#3051
File: middleware/session/session.go:215-216
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Parallel tests for `Session.Save` already exist in the `middleware/session/session_test.go` file, specifically in the `Test_Session_Save` and `Test_Session_Save_Expiration` functions.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-10-16T10:04:06.328Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/middleware_test.go:400-407
Timestamp: 2024-09-25T17:09:03.756Z
Learning: In the `Test_Session_Next` function in `middleware/session/middleware_test.go`, the variable `doNext` is properly synchronized with the `muNext` mutex for both read and write access.
cmd/internal/migrations/v3/common.go (10)
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: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-10-16T10:04:06.328Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
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.
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.
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.
Learnt from: ckoch786
PR: gofiber/fiber#3230
File: docs/whats_new.md:944-951
Timestamp: 2024-12-15T19:56:45.935Z
Learning: Detailed usage examples and explanations for new methods like `RemoveRoute` and `RemoveRouteByName` are documented in `docs/api/app.md`, so it's unnecessary to duplicate them in `docs/whats_new.md`.
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.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
🧬 Code Graph Analysis (2)
cmd/internal/migrations/v3/common_test.go (1)
cmd/internal/migrations/v3/common.go (25)
  • MigrateHandlerSignatures (15-28)
  • MigrateParserMethods (31-48)
  • MigrateRedirectMethods (51-68)
  • MigrateGenericHelpers (71-93)
  • MigrateContextMethods (96-112)
  • MigrateViewBind (115-127)
  • MigrateAllParams (130-144)
  • MigrateMount (147-159)
  • MigrateAddMethod (162-173)
  • MigrateMimeConstants (262-277)
  • MigrateLoggerTags (280-290)
  • MigrateStaticRoutes (293-335)
  • MigrateTrustedProxyConfig (338-354)
  • MigrateCORSConfig (176-212)
  • MigrateCSRFConfig (215-229)
  • MigrateMonitorImport (232-244)
  • MigrateProxyTLSConfig (247-259)
  • MigrateConfigListenerFields (359-373)
  • MigrateListenerCallbacks (377-393)
  • MigrateFilesystemMiddleware (396-427)
  • MigrateEnvVarConfig (430-441)
  • MigrateLimiterConfig (468-484)
  • MigrateHealthcheckConfig (444-465)
  • MigrateAppTestConfig (487-498)
  • MigrateMiddlewareLocals (501-526)
cmd/internal/migrations/v3/common.go (1)
cmd/internal/helpers.go (1)
  • ChangeFileContent (36-68)
🔇 Additional comments (7)
cmd/internal/migrations/v3/common_test.go (3)

14-34: LGTM! Well-designed helper functions for testing.

The helper functions provide clean abstractions for file operations and command setup in tests. The use of t.Helper(), appropriate file permissions, and proper error handling demonstrates good testing practices.


36-56: Excellent test structure and coverage.

The tests follow consistent patterns with proper setup, execution, and verification. The parallel execution and comprehensive assertions for both content transformation and logging provide robust validation of the migration functions.


176-197: Manual verification needed: ensure migration order

I wasn’t able to locate the slice or registration block in cmd/internal/migrations/v3/common.go that determines the execution order of migrations. Please confirm that MigrateViewBind is registered and runs before MigrateParserMethods to avoid incorrectly transforming new .Bind().Body( calls into .ViewBind().Body(.

cmd/internal/migrations/v3/common.go (4)

15-28: LGTM! Clean and efficient handler signature migration.

The implementation correctly transforms pointer-based context parameters to value-based ones using an efficient string replacer.


292-335: Well-implemented complex static route migration.

The function correctly handles path transformations (adding wildcards) and configuration migration from Static to static middleware. The use of strconv.Unquote for proper string handling and the comprehensive regex pattern demonstrate good attention to detail.


175-212: Excellent CORS configuration migration implementation.

The function effectively transforms comma-separated string fields to string slices using a well-designed helper function. The regex patterns are appropriate and the transformation logic is sound.


500-526: Well-structured middleware locals migration.

The function effectively replaces generic Locals lookups with typed context helpers using a clean, structured approach. The comprehensive coverage of different middleware types ensures thorough migration.

@ReneWerner87
Copy link
Member Author

@coderabbitai summary

Copy link

coderabbitai bot commented Jul 12, 2025

✅ Actions performed

Summary regeneration triggered.

@ReneWerner87 ReneWerner87 merged commit 9632f0c into master Jul 12, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in v3 Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant