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

fix: bug where non-nil, empty dynamic variables are returned as an empty interface (#1904)

This commit is contained in:
Pete Davison
2024-11-04 13:30:39 +00:00
committed by GitHub
parent 28a96d1427
commit 148b090d8e
3 changed files with 17 additions and 12 deletions

View File

@ -112,7 +112,7 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
if evaluateShVars {
err = new.Env.Range(func(k string, v ast.Var) error {
// If the variable is not dynamic, we can set it and return
if v.Value != nil || v.Sh == "" {
if v.Value != nil || v.Sh == nil {
new.Env.Set(k, ast.Var{Value: v.Value})
return nil
}
@ -301,7 +301,7 @@ func itemsFromFor(
// If the variable is dynamic, then it hasn't been resolved yet
// and we can't use it as a list. This happens when fast compiling a task
// for use in --list or --list-all etc.
if v.Value != nil && v.Sh == "" {
if v.Value != nil && v.Sh == nil {
switch value := v.Value.(type) {
case string:
if f.Split != "" {