-
-
Notifications
You must be signed in to change notification settings - Fork 716
Add solution for Challenge 1 by berkkaradalan #775
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: main
Are you sure you want to change the base?
Add solution for Challenge 1 by berkkaradalan #775
Conversation
WalkthroughAdds a new Go program for Challenge 1 that reads two comma-separated integers from stdin, exposes an exported Sum(a int, b int) int function returning a+b, and prints the result; includes simple input error handling. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (stdin)
participant Main as main()
participant Sum as Sum(a,b)
Note over User,Main: Program start — reads input
User->>Main: provide "int, int"
Main->>Main: parse input (fmt.Scanf)
alt parse success
Main->>Sum: call Sum(a,b)
Sum-->>Main: return a+b
Main->>User: print sum
else parse error
Main->>User: print error and exit
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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 |
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
🧹 Nitpick comments (2)
challenge-1/submissions/berkkaradalan/solution-template.go (2)
11-14: Consider writing errors to stderr.Error messages are currently written to stdout. For better practice, error output should go to stderr.
Apply this diff:
if err != nil { - fmt.Println("Error reading input:", err) + fmt.Fprintln(os.Stderr, "Error reading input:", err) return }You'll also need to import
os:import ( "fmt" + "os" )
22-22: Consider using grouped parameter syntax.Go allows grouping parameters of the same type for more concise syntax.
Apply this diff:
-func Sum(a int, b int) int { +func Sum(a, b int) int {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
challenge-1/submissions/berkkaradalan/solution-template.go(1 hunks)
🔇 Additional comments (1)
challenge-1/submissions/berkkaradalan/solution-template.go (1)
10-10: Input format is correct and intentional.The test file (
challenge-1/solution-template_test.go) explicitly validates comma-separated input with test cases like"2, 3","0, 0","-2, -3", confirming that the format string"%d, %d"is the intended specification for Challenge 1. All submissions and the root template consistently use this format, indicating it is the required standard.Likely an incorrect or invalid review comment.
berkkaradalan
left a 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.
fix: todo comment line removed
Challenge 1 Solution
Submitted by: @berkkaradalan
Challenge: Challenge 1
Description
This PR contains my solution for Challenge 1.
Changes
challenge-1/submissions/berkkaradalan/solution-template.goTesting
Thank you for reviewing my submission! 🚀