(value *yaml.Node)
| 58 | } |
| 59 | |
| 60 | func (p *pluginLoad) UnmarshalYAML(value *yaml.Node) error { |
| 61 | |
| 62 | sorts := make([]string, 0) |
| 63 | var itemNodes []*yaml.Node |
| 64 | |
| 65 | for i := 0; i < len(value.Content); i += 2 { |
| 66 | v := value.Content[i] |
| 67 | switch strings.ToLower(v.Value) { |
| 68 | case "version": |
| 69 | p.version = value.Content[i+1].Value |
| 70 | continue |
| 71 | case "sort": |
| 72 | err := value.Content[i+1].Decode(&sorts) |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | continue |
| 77 | case "plugin": |
| 78 | itemNodes = value.Content[i+1].Content |
| 79 | |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | items, err := pluginItemUnmarshalYAML(sorts, itemNodes) |
| 84 | if err != nil { |
| 85 | return err |
| 86 | } |
| 87 | p.defines = items |
| 88 | return nil |
| 89 | } |
| 90 | func pluginItemUnmarshalYAML(sorts []string, nodes []*yaml.Node) ([]*plugin_model.Define, error) { |
| 91 | if len(nodes) == 0 { |
| 92 | return nil, fmt.Errorf("yaml: error decoding plugin is empty") |
nothing calls this directly
no test coverage detected