Read will read the Task config defined by the [Reader]'s [Node].
(node *Node)
| 58 | |
| 59 | // Read will read the Task config defined by the [Reader]'s [Node]. |
| 60 | func (r *Reader) Read(node *Node) (*ast.TaskRC, error) { |
| 61 | var config ast.TaskRC |
| 62 | |
| 63 | if node == nil { |
| 64 | return nil, os.ErrInvalid |
| 65 | } |
| 66 | |
| 67 | // Read the file |
| 68 | b, err := os.ReadFile(node.entrypoint) //nolint:gosec |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | |
| 73 | // Parse the content |
| 74 | if err := yaml.Unmarshal(b, &config); err != nil { |
| 75 | return nil, err |
| 76 | } |
| 77 | |
| 78 | return &config, nil |
| 79 | } |
no outgoing calls
no test coverage detected