-
-
Notifications
You must be signed in to change notification settings - Fork 494
feat: added seenode recipe for go #3338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a Seenode deployment example (new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant FiberApp as "seenode/main.go\n(Fiber app)"
participant Env as "OS env (PORT)"
Note over FiberApp,Env `#DFF2E1`: Startup & request flow for Seenode example
FiberApp->>Env: os.LookupEnv("PORT")
Env-->>FiberApp: port value or empty
Note right of FiberApp: default PORT = 8080 if empty
Client->>FiberApp: HTTP GET /
FiberApp-->>Client: 200 "Hello, Welcome to seenode 👋"
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @GeoSegun, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new recipe for deploying Go Fiber applications to the Seenode cloud platform, expanding the collection of deployment examples. It includes all necessary files for a minimal Go Fiber application and comprehensive deployment instructions. Additionally, minor corrections were made to existing README files to ensure accuracy and proper linking. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new recipe for deploying a Go Fiber application to the Seenode cloud platform. The changes are well-structured, adding the necessary Go files, a go.mod file for dependencies, and a comprehensive README.md with deployment instructions. The main README.md is also updated to include this new recipe.
My review includes suggestions to improve the example code by using a non-privileged default port and adding proper error handling, which are important practices even for example code. I've also suggested a more idiomatic command for managing Go modules in the documentation.
One minor note: the pull request description mentions 'Flask', which appears to be a typo and should probably be 'Go' or 'Fiber'.
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "github.com/gofiber/fiber/v2" | ||
| ) | ||
|
|
||
| func main() { | ||
| app := fiber.New() | ||
|
|
||
| app.Get("/", func(c *fiber.Ctx) error { | ||
| return c.SendString("Hello, Welcome to seenode 👋") | ||
| }) | ||
|
|
||
| port := os.Getenv("PORT") | ||
| if port == "" { | ||
| port = "80" | ||
| } | ||
|
|
||
| app.Listen(fmt.Sprintf(":%s", port)) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start for the example application. I have a couple of suggestions to make it more robust and align with common Go practices:
- Default Port: The default port
80is a privileged port on Unix-like systems and requires root privileges. It's better to use a non-privileged port like8080for local development. - Error Handling: The
app.Listenfunction can return an error if it fails to start (e.g., port in use). This error should be handled to prevent silent failures. - Imports: It's a Go convention to group standard library imports. The
logpackage is also needed for error handling.
Here's an updated version of the file that incorporates these changes. Please also update the code example in seenode/README.md to reflect these improvements.
package main
import (
"fmt"
"log"
"os"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, Welcome to seenode 👋")
})
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
if err := app.Listen(fmt.Sprintf(":%s", port)); err != nil {
log.Fatalf("failed to start server: %v", err)
}
}|
|
||
| 2. Install dependencies: | ||
| ```sh | ||
| go get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
seenode/go.modis excluded by!**/*.modseenode/go.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (4)
README.md(2 hunks)local-development-testcontainers/README.md(1 hunks)seenode/README.md(1 hunks)seenode/main.go(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
seenode/main.go
🪛 markdownlint-cli2 (0.18.1)
seenode/README.md
24-24: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
30-30: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
44-44: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🔇 Additional comments (7)
local-development-testcontainers/README.md (1)
9-9: LGTM! Badge links correctly updated.The badge URLs now properly point to the
local-development-testcontainersdirectory, ensuring users can navigate to the correct repository location.seenode/main.go (2)
1-7: LGTM! Imports are appropriate.The package declaration and imports are correctly structured for a basic Fiber application.
9-14: LGTM! Route setup is correct.The Fiber app initialization and route handler are properly implemented for a simple welcome endpoint.
seenode/README.md (3)
1-12: LGTM! Documentation header is well-structured.The frontmatter, badges, and introduction clearly describe the Seenode deployment example.
58-81: Ensure example code is updated with error handling.The example code duplicates the main.go file and currently shows the same missing error handling issue on line 79. Once main.go is updated to properly handle the
app.Listen()error, this example should be updated to match.
83-87: LGTM! Reference links are helpful.The documentation references provide useful resources for users deploying to Seenode.
README.md (1)
60-60: LGTM! Table of contents updates are well-integrated.The changes successfully:
- Update the testcontainers entry with a more descriptive title (line 60)
- Add the new Seenode deployment example in the correct alphabetical position (line 79)
Both entries follow the established formatting pattern and provide clear descriptions.
Also applies to: 79-79
0f9c0d8 to
d359946
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
seenode/go.modis excluded by!**/*.modseenode/go.sumis excluded by!**/*.sum,!**/*.sum
📒 Files selected for processing (4)
README.md(2 hunks)local-development-testcontainers/README.md(1 hunks)seenode/README.md(1 hunks)seenode/main.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- seenode/main.go
- seenode/README.md
- local-development-testcontainers/README.md
🔇 Additional comments (2)
README.md (2)
79-79: Seenode entry is correctly positioned alphabetically.The new Seenode entry is properly placed between "RSS Feed" and "Server Timing" in alphabetical order.
15-102: ****The review comment is based on incorrect assumptions about how the auto-generated content is managed.
Analysis:
Alphabetical ordering is not enforced: The
overview.gogeneration script usesfilepath.Walk()without sorting logic, so entries appear in filesystem order, not alphabetically. The assumption that line 60 should be repositioned to align alphabetically with other "Todo" entries is incorrect.Both "Todo App" entries are distinct and valid:
local-development-testcontainersgenerates "Todo App + Auth + GORM + Testcontainers"todo-app-with-auth-gormgenerates "Todo App + Auth + GORM"These are separate recipes with different metadata and purposes, not duplicates.
Auto-generated content is properly managed: The changes appear to result from running the
overview.gogeneration script, which reads metadata from each recipe's README.md frontmatter and regenerates the entries. Git history confirms this workflow (commits show "Add Seenode recipe" viamake generate-like processes).The changes are correct as-is. No action required.
Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
seenode/README.md (1)
33-33: Usego mod tidyinstead ofgo getfor idiomatic Go module management.The
go mod tidycommand is the idiomatic way to ensure all dependencies are present andgo.mod/go.sumare properly maintained, whereasgo getis typically used to add or upgrade specific packages.- go get + go mod tidy
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md(2 hunks)seenode/README.md(1 hunks)seenode/main.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- seenode/main.go
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: ReneWerner87
Repo: gofiber/recipes PR: 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: SadikSunbul
Repo: gofiber/recipes PR: 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: itssimon
Repo: gofiber/recipes PR: 3108
File: monitoring-with-apitally/main.go:90-105
Timestamp: 2025-05-14T01:04:10.042Z
Learning: In recipe examples for the gofiber/recipes repository, it's acceptable to have placeholder comments for business logic (like data storage) when the primary focus is on demonstrating a specific integration or feature (such as Apitally monitoring).
📚 Learning: 2025-02-07T10:18:09.439Z
Learnt from: SadikSunbul
Repo: gofiber/recipes PR: 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.
Applied to files:
README.mdseenode/README.md
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
Repo: gofiber/recipes PR: 2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.
Applied to files:
README.mdseenode/README.md
📚 Learning: 2024-11-26T20:09:36.634Z
Learnt from: ReneWerner87
Repo: gofiber/recipes PR: 0
File: :0-0
Timestamp: 2024-11-26T20:09:36.634Z
Learning: In the context of the `gofiber/recipes` repository, "identical" examples refer to those using the same technologies (e.g., GORM, Ent, GCloud, Svelte) rather than having identical code.
Applied to files:
README.md
📚 Learning: 2024-12-01T01:15:48.126Z
Learnt from: juls0730
Repo: gofiber/recipes PR: 2710
File: tableflip/main.go:61-62
Timestamp: 2024-12-01T01:15:48.126Z
Learning: In the GoFiber `tableflip` recipe (`tableflip/main.go`), the implementation matches the upstream reference implementation. Future code suggestions should consider maintaining this alignment to ensure consistency.
Applied to files:
README.md
📚 Learning: 2025-05-14T01:04:10.042Z
Learnt from: itssimon
Repo: gofiber/recipes PR: 3108
File: monitoring-with-apitally/main.go:90-105
Timestamp: 2025-05-14T01:04:10.042Z
Learning: In recipe examples for the gofiber/recipes repository, it's acceptable to have placeholder comments for business logic (like data storage) when the primary focus is on demonstrating a specific integration or feature (such as Apitally monitoring).
Applied to files:
README.mdseenode/README.md
📚 Learning: 2025-02-12T11:24:31.153Z
Learnt from: ReneWerner87
Repo: gofiber/storage PR: 0
File: :0-0
Timestamp: 2025-02-12T11:24:31.153Z
Learning: The storage package in gofiber/storage repository can be used independently of the Fiber web framework.
Applied to files:
README.md
📚 Learning: 2024-11-23T19:35:36.767Z
Learnt from: norri
Repo: gofiber/recipes PR: 2701
File: clean-code/app/main.go:0-0
Timestamp: 2024-11-23T19:35:36.767Z
Learning: In the Go `clean-code` example (`clean-code/app/main.go`) in the `gofiber/recipes` repository, it's acceptable to omit graceful shutdown handling, as the example code prioritizes simplicity over production-level practices.
Applied to files:
README.md
📚 Learning: 2025-02-07T10:16:46.994Z
Learnt from: SadikSunbul
Repo: gofiber/recipes PR: 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.
Applied to files:
README.mdseenode/README.md
📚 Learning: 2025-10-22T13:48:12.485Z
Learnt from: CR
Repo: gofiber/fiber PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-22T13:48:12.485Z
Learning: Applies to **/*.go : Modernize code using gopls modernize (Make target: modernize)
Applied to files:
seenode/README.md
📚 Learning: 2025-10-22T13:48:12.485Z
Learnt from: CR
Repo: gofiber/fiber PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-22T13:48:12.485Z
Learning: Run audit checks (`go mod verify`, `go vet`, `govulncheck`) via `make audit` before submitting changes
Applied to files:
seenode/README.md
📚 Learning: 2024-11-26T20:05:15.793Z
Learnt from: ReneWerner87
Repo: gofiber/recipes PR: 0
File: :0-0
Timestamp: 2024-11-26T20:05:15.793Z
Learning: For future contributions to the `gofiber/recipes` repository, ensure that the tasks outlined in `.github/CONTRIBUTING.md` are incorporated, including creating a new directory without a "fiber" prefix, adding a `README.md` with Docusaurus metadata, and updating the overview by running `make generate`.
Applied to files:
seenode/README.md
🪛 markdownlint-cli2 (0.18.1)
seenode/README.md
24-24: Trailing spaces
Expected: 0 or 2; Actual: 4
(MD009, no-trailing-spaces)
31-31: Trailing spaces
Expected: 0 or 2; Actual: 4
(MD009, no-trailing-spaces)
46-46: Trailing spaces
Expected: 0 or 2; Actual: 4
(MD009, no-trailing-spaces)
🔇 Additional comments (4)
seenode/README.md (1)
61-87: Verify the example main.go file matches the implementation in seenode/main.go.The README displays an example Go application (lines 61-87) that should be reflected in the actual
seenode/main.gofile. Ensure the two are consistent so readers can directly use the code shown in the README.README.md (3)
78-78: Alphabetical ordering looks good.The "Seenode" entry is correctly positioned alphabetically between "RSS Feed" (R) and "Server Timing" (S). The previous critical issue with broken alphabetical ordering has been resolved.
93-94: Todo App entries are well-clarified with specific technology stacks.Splitting the generic "Todo App + Auth + GORM" entry into two distinct entries specifying Testcontainers (Postgres) and SQLite variants improves clarity for users choosing the appropriate recipe. Both entries are correctly positioned alphabetically between "Template Asset Bundling" (T) and "Unit Testing" (U).
78-78: Verify contribution guidelines compliance.According to learnings from the repository, contributions should follow tasks outlined in
.github/CONTRIBUTING.md, including runningmake generateto update the TOC. Ensure this command was executed and the auto-generated content (lines 15-102) reflects the final state.Also applies to: 93-94
| ## Setup | ||
|
|
||
| 1. Clone the repository: | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing spaces from empty lines.
Static analysis detected trailing spaces on lines 24, 31, and 46 (between list items and code blocks). These violate markdown linting rules (MD009).
1. Clone the repository:
-
+
```shApply the same fix to lines 31 and 46.
Also applies to: 31-31, 46-46
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
24-24: Trailing spaces
Expected: 0 or 2; Actual: 4
(MD009, no-trailing-spaces)
🤖 Prompt for AI Agents
In seenode/README.md around lines 24, 31, and 46, there are trailing spaces on
otherwise-empty lines that violate MD009; remove the trailing whitespace on each
of those empty lines (and ensure no other adjacent blank lines gain trailing
spaces) so the Markdown linter no longer flags them.
Added recipe for seenode, which has first-class support for Fiber.
Summary by CodeRabbit
New Features
Documentation