Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ordered map race #1701

Closed
wants to merge 25 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
trim21 committed Sep 7, 2024

Verified

This commit was signed with the committer’s verified signature.
trim21 Trim21
commit 4e1ab41efc7142a170bb8f45086ba09e4bec1aa2
2 changes: 1 addition & 1 deletion taskfile/ast/for.go
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ func (f *For) UnmarshalYAML(node *yaml.Node) error {
if forStruct.Var != "" && forStruct.Matrix.Len() != 0 {
return errors.NewTaskfileDecodeError(nil, node).WithMessage("cannot use both var and matrix in for")
}
f.Matrix = forStruct.Matrix
f.Matrix = forStruct.Matrix.DeepCopy()
f.Var = forStruct.Var
f.Split = forStruct.Split
f.As = forStruct.As
4 changes: 2 additions & 2 deletions variables.go
Original file line number Diff line number Diff line change
@@ -274,7 +274,7 @@ func itemsFromFor(
var values []any // The list of values to loop over
// Get the list from a matrix
if f.Matrix.Len() != 0 {
return asAnySlice(product(f.Matrix)), nil, nil
return asAnySlice(product(&f.Matrix)), nil, nil
}
// Get the list from the explicit for list
if len(f.List) > 0 {
@@ -329,7 +329,7 @@ func itemsFromFor(
}

// product generates the cartesian product of the input map of slices.
func product(inputMap omap.OrderedMap[string, []any]) []map[string]any {
func product(inputMap *omap.OrderedMap[string, []any]) []map[string]any {
if inputMap.Len() == 0 {
return nil
}