Skip to content

Commit

Permalink
fix: variables passed to included taskfile (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
pd93 authored Mar 10, 2024
1 parent a425e2b commit c0a0faf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ func (c *Compiler) getVariables(t *ast.Task, call *ast.Call, evaluateShVars bool
return nil, err
}
if t != nil {
if err := t.IncludedTaskfileVars.Range(taskRangeFunc); err != nil {
if err := t.IncludeVars.Range(rangeFunc); err != nil {
return nil, err
}
if err := t.IncludeVars.Range(rangeFunc); err != nil {
if err := t.IncludedTaskfileVars.Range(taskRangeFunc); err != nil {
return nil, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ Hello bar
`)
require.NoError(t, e.Run(context.Background(), &ast.Call{Task: "default"}))
t.Log(buff.String())
assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder)
assert.Equal(t, expectedOutputOrder, strings.TrimSpace(buff.String()))
}

func TestErrorCode(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/include_with_vars_multi_level/lib/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"

vars:
RECEIVER: "world"
RECEIVER: '{{ .RECEIVER | default "world" }}'

tasks:
greet:
Expand Down

0 comments on commit c0a0faf

Please sign in to comment.