1
0
mirror of https://github.com/go-task/task.git synced 2025-07-17 01:43:07 +02:00

Refactor variables: Keep order of declaration

This shouldn't have any behavior changes for now. This is a code
refactor that should allow us to do further improvements on how
variables are handled, specially regarding respecting the declaration
order in Taskfiles, which should make it easier for the users.

Initial work on #218
This commit is contained in:
Andrey Nering
2020-03-29 16:54:59 -03:00
parent a044c41c66
commit 6ed30f1add
17 changed files with 188 additions and 115 deletions

View File

@ -10,14 +10,14 @@ type Cmd struct {
Cmd string
Silent bool
Task string
Vars Vars
Vars *Vars
IgnoreError bool
}
// Dep is a task dependency
type Dep struct {
Task string
Vars Vars
Vars *Vars
}
var (
@ -51,7 +51,7 @@ func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
}
var taskCall struct {
Task string
Vars Vars
Vars *Vars
}
if err := unmarshal(&taskCall); err == nil {
c.Task = taskCall.Task
@ -70,7 +70,7 @@ func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error {
}
var taskCall struct {
Task string
Vars Vars
Vars *Vars
}
if err := unmarshal(&taskCall); err == nil {
d.Task = taskCall.Task