MCPcopy
hub / github.com/go-task/task / DeepCopy

Method DeepCopy

taskfile/ast/matrix.go:101–109  ·  view source on GitHub ↗

DeepCopy returns a copy of the MatrixRow. Without this, deepcopy.OrderedMap falls back to copying the *MatrixRow pointer as-is, so every "copy" of a Matrix would still share the same underlying rows - see #2890, where concurrent invocations of a task with a `ref:` matrix row raced on resolveMatrixRe

()

Source from the content-addressed store, hash-verified

99// concurrent invocations of a task with a `ref:` matrix row raced on
100// resolveMatrixRefs mutating that shared row.
101func (row *MatrixRow) DeepCopy() *MatrixRow {
102 if row == nil {
103 return nil
104 }
105 return &MatrixRow{
106 Ref: row.Ref,
107 Value: deepcopy.Slice(row.Value),
108 }
109}
110
111func (matrix *Matrix) UnmarshalYAML(node *yaml.Node) error {
112 switch node.Kind {

Callers

nothing calls this directly

Calls 1

SliceFunction · 0.92

Tested by

no test coverage detected