This is a simple CLI-based Todo application built in Go. It allows you to manage tasks by adding, marking as complete, viewing, and deleting them. Tasks are saved to a JSON file so they persist between sessions.
- Add tasks with descriptions
- Mark tasks as complete
- Delete tasks with confirmation
- View all tasks or individual tasks by ID
- Persistent storage using a JSON file
- Modular code structure with a
task
package - Unit tests for core functionality
- Go installed on your machine (version 1.18+ recommended)
-
Clone the repository to your local machine.
-
Initialize the module if not already done:
go mod init todo-app
-
Usage
go run main.go
Upon running the application, a menu will be displayed with options:
- List all tasks - View all tasks with their completion status.
- Add a task - Create a new task by providing a description.
- Mark a task as complete - Set the completion status of a task by entering its ID.
- View a specific task - Display details of a task by entering its ID.
- Delete a task - Remove a task by ID, with confirmation.
- Exit - Quit the application.
main.go
- Contains the main program and manu handlingtask/
- Contains theTask
struct, functions for managing tasks, and data persistence.task/task_test.go
- Contains unit tests for task-related functions.
To run the unit tests for this project:
go test ./task
This will execute tests for the core functionality in the task
package, ensuring that adding, completing and deleting tasks works as expected.
- Filtering - Add options to filter completed and incomplete tasks.
- API Conversion - Convert the application to a REST API using
net/http
andgorilla/mux
. - Enhanced Validation - Add checks to prevent adding empty tasks.
This project is open-source and available under the MIT License.