1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

refactor: rename Var.Static to Var.Value

This commit is contained in:
Pete Davison
2023-11-28 18:18:28 +00:00
parent f58257a208
commit de09e675c1
13 changed files with 54 additions and 54 deletions

View File

@@ -42,7 +42,7 @@ func Dotenv(c compiler.Compiler, tf *taskfile.Taskfile, dir string) (*taskfile.V
}
for key, value := range envs {
if ok := env.Exists(key); !ok {
env.Set(key, taskfile.Var{Static: value})
env.Set(key, taskfile.Var{Value: value})
}
}
}

View File

@@ -41,8 +41,8 @@ vars:
Task: "another-task", Vars: &taskfile.Vars{
OrderedMap: orderedmap.FromMapWithOrder(
map[string]taskfile.Var{
"PARAM1": {Static: "VALUE1"},
"PARAM2": {Static: "VALUE2"},
"PARAM1": {Value: "VALUE1"},
"PARAM2": {Value: "VALUE2"},
},
[]string{"PARAM1", "PARAM2"},
),
@@ -61,7 +61,7 @@ vars:
Task: "some_task", Vars: &taskfile.Vars{
OrderedMap: orderedmap.FromMapWithOrder(
map[string]taskfile.Var{
"PARAM1": {Static: "var"},
"PARAM1": {Value: "var"},
},
[]string{"PARAM1"},
),
@@ -81,8 +81,8 @@ vars:
Task: "another-task", Vars: &taskfile.Vars{
OrderedMap: orderedmap.FromMapWithOrder(
map[string]taskfile.Var{
"PARAM1": {Static: "VALUE1"},
"PARAM2": {Static: "VALUE2"},
"PARAM1": {Value: "VALUE1"},
"PARAM2": {Value: "VALUE2"},
},
[]string{"PARAM1", "PARAM2"},
),

View File

@@ -27,7 +27,7 @@ func (vs *Vars) ToCacheMap() (m map[string]any) {
if v.Live != nil {
m[k] = v.Live
} else {
m[k] = v.Static
m[k] = v.Value
}
return nil
})
@@ -71,10 +71,10 @@ func (vs *Vars) DeepCopy() *Vars {
// Var represents either a static or dynamic variable.
type Var struct {
Static string
Live any
Sh string
Dir string
Value string
Live any
Sh string
Dir string
}
func (v *Var) UnmarshalYAML(node *yaml.Node) error {
@@ -85,7 +85,7 @@ func (v *Var) UnmarshalYAML(node *yaml.Node) error {
if err := node.Decode(&str); err != nil {
return err
}
v.Static = str
v.Value = str
return nil
case yaml.MappingNode: