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

Method Set

taskfile/ast/vars.go:62–72  ·  view source on GitHub ↗

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

(key string, value Var)

Source from the content-addressed store, hash-verified

60// value. If the variable already exists, its value is updated. If the variable
61// does not exist, it is created.
62func (vars *Vars) Set(key string, value Var) bool {
63 if vars == nil {
64 vars = NewVars()
65 }
66 if vars.om == nil {
67 vars.om = orderedmap.NewOrderedMap[string, Var]()
68 }
69 defer vars.mutex.Unlock()
70 vars.mutex.Lock()
71 return vars.om.Set(key, value)
72}
73
74// All returns an iterator that loops over all task key-value pairs.
75func (vars *Vars) All() iter.Seq2[string, Var] {

Callers 15

runMethod · 0.95
runMethod · 0.95
TestSplitArgsFunction · 0.95
compiledTaskMethod · 0.95
ReplaceVarsWithExtraFunction · 0.95
GetEnvironFunction · 0.95
runFunction · 0.95
DotenvFunction · 0.95
NewVarsFunction · 0.95
UnmarshalYAMLMethod · 0.95
ParseFunction · 0.95

Calls 1

NewVarsFunction · 0.85

Tested by 4

runMethod · 0.76
runMethod · 0.76
TestSplitArgsFunction · 0.76