Skip to content
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

Update README.md #3165

Merged
merged 1 commit into from
Oct 12, 2024
Merged

Update README.md #3165

merged 1 commit into from
Oct 12, 2024

Conversation

s19835
Copy link
Contributor

@s19835 s19835 commented Oct 12, 2024

Missing a pointer reference when passing the context object in the route handler function. In Fiber, the context (c) is a pointer, so it should be *fiber.Ctx instead of fiber.Ctx.

Missing a pointer reference when passing the context object in the route handler function. In Fiber, the context (c) is a pointer, so it should be *fiber.Ctx instead of fiber.Ctx.
@s19835 s19835 requested a review from a team as a code owner October 12, 2024 13:55
@s19835 s19835 requested review from gaby, sixcolors, ReneWerner87 and efectn and removed request for a team October 12, 2024 13:55
Copy link

welcome bot commented Oct 12, 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
Contributor

coderabbitai bot commented Oct 12, 2024

Walkthrough

The changes in this pull request focus on updating the .github/README.md file for the Fiber web framework. The primary modification is the alteration of a function signature in the example code for initializing a route, changing the parameter type for the context from func(c fiber.Ctx) error to func(c *fiber.Ctx) error. This change reflects a transition from passing the context by value to passing it by reference.

Changes

File Change Summary
.github/README.md Updated function signature in example code from func(c fiber.Ctx) error to func(c *fiber.Ctx) error.

Possibly related PRs

  • [📚 Doc: typo in hooks documentation #3164] The changes in this PR are unrelated to the main PR as they focus solely on correcting typographical errors in documentation without altering any function signatures or code logic.

Suggested labels

📒 Documentation, v3

Suggested reviewers

  • sixcolors
  • ReneWerner87
  • gaby
  • efectn

🐇 In the README, a change so bright,
From value to reference, it feels just right.
With fiber we weave, our routes now align,
A hop and a skip, our code will shine!
Let's share this joy, in every byte,
For every handler, a new delight! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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 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.

Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (1)
.github/README.md (1)

Inconsistent Route Handler Signatures Across Documentation

The .github/README.md has been correctly updated to reflect the new route handler signatures. However, several other documentation files still use the outdated func(c fiber.Ctx) error or func(c *fiber.Ctx) error patterns. To ensure consistency and avoid confusion for users, please update all markdown documentation files to use the updated route handler signatures.

  • Update the following files:
    • docs/whats_new.md
    • docs/partials/routing/handler.md
    • docs/middleware/*.md
    • docs/intro.md
    • docs/guide/*.md
    • docs/api/*.md
    • binder/README.md
🔗 Analysis chain

Line range hint 1-2000: Overall assessment of the README update

The change made to the README.md file correctly addresses the issue described in the PR objectives. The update to the function signature in the example code ensures that users will use the correct type for the context parameter in their route handlers.

However, to maintain consistency throughout the documentation, it's recommended to review the entire README and any other documentation files to ensure that all examples and explanations reflect this change. This will help prevent any confusion for users who might encounter outdated information elsewhere in the documentation.

To ensure comprehensive documentation update, let's check for any other files that might contain similar code examples:


To ensure all markdown files are consistently updated with the correct Fiber route handler examples, let's run a revised shell script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for markdown files containing Fiber route handler examples
fd -e md -x rg --type md 'func\(c (fiber\.Ctx|\*fiber\.Ctx)\) error' {}

Length of output: 1035


Script:

#!/bin/bash
# Search for markdown files containing Fiber route handler examples with correct context parameter
fd -e md | xargs rg --no-heading 'func\(c \*?fiber\.Ctx\) error'

Length of output: 15905

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 48e82e7 and a315ca6.

📒 Files selected for processing (1)
  • .github/README.md (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
.github/README.md (1)

76-76: Correct update to the context parameter type.

The change from func(c fiber.Ctx) error to func(c *fiber.Ctx) error accurately reflects the proper usage of the context object in Fiber v3. This modification ensures that the context is passed by reference, which is the correct way to handle it in the framework.

To ensure consistency across the documentation, let's check for any other occurrences of the old signature:

#!/bin/bash
# Search for any remaining instances of the old signature
rg --type md 'func\(c fiber\.Ctx\) error' .github/README.md

@efectn efectn merged commit 9dd3d94 into gofiber:main Oct 12, 2024
3 checks passed
Copy link

welcome bot commented Oct 12, 2024

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@gaby gaby added the v3 label Oct 12, 2024
gaby added a commit that referenced this pull request Oct 12, 2024
@gaby
Copy link
Member

gaby commented Oct 12, 2024

@s19835 @efectn There's no pointer in v3, this was not needed

@gaby
Copy link
Member

gaby commented Oct 12, 2024

@s19835 The context pointer is a Fiber v2 thing. For v3 which is what main is right now, the pointer was removed.

efectn pushed a commit that referenced this pull request Oct 13, 2024
@s19835 s19835 deleted the patch-1 branch October 19, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants