Add solution for Challenge 3 by saranyakuringi#1677
Conversation
WalkthroughAdds ChangesEmployee Manager Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 167573e7-a13a-432d-a6b7-fe47a79e92dd
📒 Files selected for processing (1)
challenge-3/submissions/saranyakuringi/solution-template.go
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23a85d8b-4d59-4b16-8d0a-5b4f927835ff
📒 Files selected for processing (1)
challenge-3/submissions/saranyakuringi/solution-template.go
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 00f270fe-b906-4aa0-8930-6c80f3b7f47d
📒 Files selected for processing (1)
challenge-3/submissions/saranyakuringi/solution-template.go
| for i := 0; i < len(m.Employees); i++ { | ||
| if m.Employees[i].ID == id { | ||
| + m.Employees = append(m.Employees[:i], m.Employees[i+1:]...) | ||
| + return | ||
| + } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify no diff-marker '+' prefixes remain in the reviewed file.
rg -n '^\+' challenge-3/submissions/saranyakuringi/solution-template.goRepository: RezaSi/go-interview-practice
Length of output: 161
Remove diff markers from Go code at lines 25–27.
Lines 25–27 contain leading + characters that make the function invalid Go syntax, causing the CI failure (unexpected keyword return, expected expression). Remove the + prefixes before each statement:
Proposed fix
func (m *Manager) RemoveEmployee(id int) {
for i := 0; i < len(m.Employees); i++ {
if m.Employees[i].ID == id {
-+ m.Employees = append(m.Employees[:i], m.Employees[i+1:]...)
-+ return
-+ }
+ m.Employees = append(m.Employees[:i], m.Employees[i+1:]...)
+ return
+ }
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for i := 0; i < len(m.Employees); i++ { | |
| if m.Employees[i].ID == id { | |
| + m.Employees = append(m.Employees[:i], m.Employees[i+1:]...) | |
| + return | |
| + } | |
| func (m *Manager) RemoveEmployee(id int) { | |
| for i := 0; i < len(m.Employees); i++ { | |
| if m.Employees[i].ID == id { | |
| m.Employees = append(m.Employees[:i], m.Employees[i+1:]...) | |
| return | |
| } | |
| } | |
| } |
🧰 Tools
🪛 GitHub Actions: PR Tests / 1_test-submissions (challenge-3).txt
[error] 26-26: Go test failed with syntax error: unexpected keyword return, expected expression at ./solution-template.go:26:5.
Challenge 3 Solution
Submitted by: @saranyakuringi
Challenge: Challenge 3
Description
This PR contains my solution for Challenge 3.
Changes
challenge-3/submissions/saranyakuringi/solution-template.goTesting
Thank you for reviewing my submission! 🚀