MCPcopy
hub / github.com/go-task/task / Set

Method Set

taskfile/ast/tasks.go:66–76  ·  view source on GitHub ↗

Set sets the value of the task with the provided key to the provided value. If the task already exists, its value is updated. If the task does not exist, it is created.

(key string, value *Task)

Source from the content-addressed store, hash-verified

64// If the task already exists, its value is updated. If the task does not exist,
65// it is created.
66func (tasks *Tasks) Set(key string, value *Task) bool {
67 if tasks == nil {
68 tasks = NewTasks()
69 }
70 if tasks.om == nil {
71 tasks.om = orderedmap.NewOrderedMap[string, *Task]()
72 }
73 defer tasks.mutex.Unlock()
74 tasks.mutex.Lock()
75 return tasks.om.Set(key, value)
76}
77
78// All returns an iterator that loops over all task key-value pairs in the order
79// specified by the sorter.

Callers 4

TestPrintAllWithSpacesFunction · 0.95
NewTasksFunction · 0.95
MergeMethod · 0.95
UnmarshalYAMLMethod · 0.95

Calls 1

NewTasksFunction · 0.85

Tested by 1

TestPrintAllWithSpacesFunction · 0.76