MCPcopy Create free account
hub / github.com/go-task/task / UnmarshalYAML

Method UnmarshalYAML

taskfile/ast/platforms.go:38–51  ·  view source on GitHub ↗

UnmarshalYAML implements yaml.Unmarshaler interface.

(node *yaml.Node)

Source from the content-addressed store, hash-verified

36
37// UnmarshalYAML implements yaml.Unmarshaler interface.
38func (p *Platform) UnmarshalYAML(node *yaml.Node) error {
39 switch node.Kind {
40 case yaml.ScalarNode:
41 var platform string
42 if err := node.Decode(&platform); err != nil {
43 return errors.NewTaskfileDecodeError(err, node)
44 }
45 if err := p.parsePlatform(platform); err != nil {
46 return errors.NewTaskfileDecodeError(err, node)
47 }
48 return nil
49 }
50 return errors.NewTaskfileDecodeError(nil, node).WithTypeMessage("platform")
51}
52
53// parsePlatform takes a string representing an OS/Arch combination (or either on their own)
54// and parses it into the Platform struct. It returns an error if the input string is invalid.

Callers

nothing calls this directly

Calls 3

parsePlatformMethod · 0.95
NewTaskfileDecodeErrorFunction · 0.92
WithTypeMessageMethod · 0.80

Tested by

no test coverage detected