mobyvb / tasklist

a tool to keep track of tasks and how long you've been working on them
0 stars 0 forks source link

Get rid of globals #25

Open black-crowned-night-heron opened 1 year ago

black-crowned-night-heron commented 1 year ago

I have created a new type TaskList which is a struct containing a slice of Task structs. All the previous methods which were operating on the global Tasks slice are now methods on the TaskList struct and operate on the Tasks field inside the TaskList structure. In fact, the main.go file does not contain any global variables anymore: the filename is passed directly as an argument to the loadTasksFromFile and saveTasksToFile methods and a new TaskList instance is created directly in the main function.

Resolves #23