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

fix Taskvars.yml vars not available while interpolating vars prop

closes #40
This commit is contained in:
Andrey Nering
2017-07-15 14:40:58 -03:00
parent ac7ab42d94
commit 5ece1d74f6
4 changed files with 6 additions and 1 deletions

View File

@ -98,7 +98,7 @@ func (e *Executor) Run(args ...string) error {
} }
for _, a := range args { for _, a := range args {
if err := e.RunTask(context.Background(), Call{Task: a}); err != nil { if err := e.RunTask(context.Background(), Call{Task: a, Vars: e.taskvars}); err != nil {
return err return err
} }
} }

View File

@ -236,6 +236,7 @@ func TestParams(t *testing.T) {
{"dep2.txt", "Dependence2\n"}, {"dep2.txt", "Dependence2\n"},
{"spanish.txt", "¡Holla mundo!\n"}, {"spanish.txt", "¡Holla mundo!\n"},
{"spanish-dep.txt", "¡Holla dependencia!\n"}, {"spanish-dep.txt", "¡Holla dependencia!\n"},
{"portuguese.txt", "Olá, mundo!\n"},
} }
for _, f := range files { for _, f := range files {

View File

@ -1,6 +1,7 @@
default: default:
vars: vars:
SPANISH: ¡Holla mundo! SPANISH: ¡Holla mundo!
PORTUGUESE: "{{.PORTUGUESE}}"
deps: deps:
- task: write-file - task: write-file
vars: {CONTENT: Dependence1, FILE: dep1.txt} vars: {CONTENT: Dependence1, FILE: dep1.txt}
@ -17,6 +18,8 @@ default:
vars: {CONTENT: "!", FILE: exclamation.txt} vars: {CONTENT: "!", FILE: exclamation.txt}
- task: write-file - task: write-file
vars: {CONTENT: "{{.SPANISH}}", FILE: spanish.txt} vars: {CONTENT: "{{.SPANISH}}", FILE: spanish.txt}
- task: write-file
vars: {CONTENT: "{{.PORTUGUESE}}", FILE: portuguese.txt}
write-file: write-file:
cmds: cmds:

1
testdata/params/Taskvars.yml vendored Normal file
View File

@ -0,0 +1 @@
PORTUGUESE: Olá, mundo!