UnmarshalYAML implements yaml.Unmarshaler interface.
(node *yaml.Node)
| 36 | |
| 37 | // UnmarshalYAML implements yaml.Unmarshaler interface. |
| 38 | func (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. |
nothing calls this directly
no test coverage detected