package task import ( "sync" ) type Status string const ( StatusPending Status = "pending" StatusWorking Status = "working" StatusError Status = "error" StatusDone Status = "done" ) type list struct { rw sync.RWMutex cond *sync.Cond Tasks []Task `json:"tasks"` OldTasks []Task `json:"old_tasks"` } var taskList list func init() { taskList = list{ Tasks: []Task{}, OldTasks: []Task{}, } taskList.cond = sync.NewCond(&taskList.rw) }