LoadFile takes a file at the given path and returns a File object
(path string)
| 45 | |
| 46 | // LoadFile takes a file at the given path and returns a File object |
| 47 | func LoadFile(path string) (*File, error) { |
| 48 | r := new(File) |
| 49 | b, err := os.ReadFile(path) |
| 50 | if err != nil { |
| 51 | return r, fmt.Errorf("couldn't load repositories file (%s): %w", path, err) |
| 52 | } |
| 53 | |
| 54 | err = yaml.Unmarshal(b, r) |
| 55 | return r, err |
| 56 | } |
| 57 | |
| 58 | // Add adds one or more repo entries to a repo file. |
| 59 | func (r *File) Add(re ...*Entry) { |
no outgoing calls
searching dependent graphs…