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

Method UnmarshalYAML

taskfile/ast/dep.go:29–58  ·  view source on GitHub ↗
(node *yaml.Node)

Source from the content-addressed store, hash-verified

27}
28
29func (d *Dep) UnmarshalYAML(node *yaml.Node) error {
30 switch node.Kind {
31
32 case yaml.ScalarNode:
33 var task string
34 if err := node.Decode(&task); err != nil {
35 return errors.NewTaskfileDecodeError(err, node)
36 }
37 d.Task = task
38 return nil
39
40 case yaml.MappingNode:
41 var taskCall struct {
42 Task string
43 For *For
44 Vars *Vars
45 Silent bool
46 }
47 if err := node.Decode(&taskCall); err != nil {
48 return errors.NewTaskfileDecodeError(err, node)
49 }
50 d.Task = taskCall.Task
51 d.For = taskCall.For
52 d.Vars = taskCall.Vars
53 d.Silent = taskCall.Silent
54 return nil
55 }
56
57 return errors.NewTaskfileDecodeError(nil, node).WithTypeMessage("dependency")
58}

Callers

nothing calls this directly

Calls 2

NewTaskfileDecodeErrorFunction · 0.92
WithTypeMessageMethod · 0.80

Tested by

no test coverage detected