Exercise: Delete a To-Do item
Test your coding skills by deleting a to-do item.
We'll cover the following
Challenge
In this exercise, your challenge is to expand the todo
command-line tool by allowing users to delete items from the list.
Problem statement
Using the current version of the todo
application, a user can add, complete, and list items. However, users cannot delete any items from the list, which means it could grow to a point where it’s hard to maintain.
Coding challenge
Implement an additional flag called -del
that allows a user to delete an item from the list. Update the file main.go
from the end of this chapter and use the Delete()
method, which is already available in the to-do API, to perform the action.
If you feel stuck, refer to Go’s documentation for the flag
package. If you still need help, check the solution review in the next lesson. Good luck!
Get hands-on with 1400+ tech skills courses.