Example #1
0
// Should be common to other updaters
func PatchFile(ru RequirementUpdate, orgDepFiles, uptDepFiles *[]models.DependencyFile) error {
	var f models.DependencyFile = ru.File
	err := f.CheckFileSHA1()
	if err != nil {
		return err
	}
	// fetch file content
	f.Update()
	*orgDepFiles = append(*orgDepFiles, f)
	fmt.Println("Patching", f.Path)
	err = f.Patch(ru.Patch)
	if err != nil {
		return err
	}
	*uptDepFiles = append(*uptDepFiles, f)
	return nil
}