feature/recipe_implementation #5

Merged
gmgauthier merged 54 commits from feature/recipe_implementation into master 2026-03-07 23:17:54 +00:00
Showing only changes of commit 1c79abce8d - Show all commits

View File

@ -211,12 +211,23 @@ func createUnifiedPatch(changes []FileChange, patchPath string) error {
if err != nil {
return err
}
defer f.Close()
defer func(f *os.File) {
err := f.Close()
if err != nil {
return
}
}(f)
for _, ch := range changes {
fmt.Fprintf(f, "--- %s\n+++ %s\n@@ -0,0 +1,%d @@\n", ch.File, ch.File, strings.Count(ch.Content, "\n")+1)
_, err := fmt.Fprintf(f, "--- %s\n+++ %s\n@@ -0,0 +1,%d @@\n", ch.File, ch.File, strings.Count(ch.Content, "\n")+1)
if err != nil {
return err
}
for _, line := range strings.Split(ch.Content, "\n") {
fmt.Fprintf(f, "+%s\n", line)
_, err := fmt.Fprintf(f, "+%s\n", line)
if err != nil {
return err
}
}
}
return nil