DeepCopy creates a new instance of Task and copies data by value from the source struct.
()
| 214 | // DeepCopy creates a new instance of Task and copies |
| 215 | // data by value from the source struct. |
| 216 | func (t *Task) DeepCopy() *Task { |
| 217 | if t == nil { |
| 218 | return nil |
| 219 | } |
| 220 | c := &Task{ |
| 221 | Task: t.Task, |
| 222 | Cmds: deepcopy.Slice(t.Cmds), |
| 223 | Deps: deepcopy.Slice(t.Deps), |
| 224 | Label: t.Label, |
| 225 | Desc: t.Desc, |
| 226 | Prompt: t.Prompt, |
| 227 | Summary: t.Summary, |
| 228 | Aliases: deepcopy.Slice(t.Aliases), |
| 229 | Sources: deepcopy.Slice(t.Sources), |
| 230 | Generates: deepcopy.Slice(t.Generates), |
| 231 | Status: deepcopy.Slice(t.Status), |
| 232 | Preconditions: deepcopy.Slice(t.Preconditions), |
| 233 | Dir: t.Dir, |
| 234 | Set: deepcopy.Slice(t.Set), |
| 235 | Shopt: deepcopy.Slice(t.Shopt), |
| 236 | Vars: t.Vars.DeepCopy(), |
| 237 | Env: t.Env.DeepCopy(), |
| 238 | Dotenv: deepcopy.Slice(t.Dotenv), |
| 239 | Silent: deepcopy.Scalar(t.Silent), |
| 240 | Interactive: t.Interactive, |
| 241 | Internal: t.Internal, |
| 242 | Method: t.Method, |
| 243 | Prefix: t.Prefix, |
| 244 | IgnoreError: t.IgnoreError, |
| 245 | UseGitignore: deepcopy.Scalar(t.UseGitignore), |
| 246 | Run: t.Run, |
| 247 | IncludeVars: t.IncludeVars.DeepCopy(), |
| 248 | IncludedTaskfileVars: t.IncludedTaskfileVars.DeepCopy(), |
| 249 | Platforms: deepcopy.Slice(t.Platforms), |
| 250 | If: t.If, |
| 251 | Location: t.Location.DeepCopy(), |
| 252 | Requires: t.Requires.DeepCopy(), |
| 253 | Namespace: t.Namespace, |
| 254 | FullName: t.FullName, |
| 255 | Watch: t.Watch, |
| 256 | Failfast: t.Failfast, |
| 257 | } |
| 258 | return c |
| 259 | } |