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

Fix delete method #28

Open
wants to merge 1 commit into
base: episode_7
Choose a base branch
from

Conversation

szaffarano
Copy link

Fixes #27

@@ -92,7 +92,10 @@ func DeleteProduct(id int) error {
return ErrProductNotFound
}

productList = append(productList[:i], productList[i+1])
copy(productList[i:], productList[i+1:])
Copy link

@kwiat1990 kwiat1990 Jan 12, 2022

Choose a reason for hiding this comment

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

Hey, I think you could write it like productList = append(productList[:i], productList[i+1:]...) and omit the rest of the new code. With this change it should work. I've tested it and got the right product deleted.

The very same fix was introduces in this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants