@@ -233,32 +233,18 @@ func runCheck(dir string, prog string) int {
233233 log .Fatal (err )
234234 }
235235
236- patchURL := "https://gist.githubusercontent.com/blurbdust/77bddb721489fa4359b7af17f68321a0/raw/9b6cafef6f9d2452dea57b6a2ece51eed75c3448/rt.patch"
237- tmpFile , err := os .CreateTemp ("" , "rt.patch" )
238- if err != nil {
239- panic (err )
240- }
241- defer os .Remove (tmpFile .Name ()) // Remove the temporary file when we're done with it
236+ patchURL := "https://gist.githubusercontent.com/blurbdust/77bddb721489fa4359b7af17f68321a0/raw/ffd0b23ed0972dd609d816ee9f3e6a064a59504a/rt.patch"
242237
243- // Download the zip file and save it to the temporary file
238+ // Download the patch file and save it to the temporary file
244239 resp , err := http .Get (patchURL )
245240 if err != nil {
246241 panic (err )
247242 }
248- defer resp .Body .Close ()
249- _ , err = io .Copy (tmpFile , resp .Body )
250- if err != nil {
251- panic (err )
252- }
253-
254- patch , err := os .Open ("rt.patch" )
255- if err != nil {
256- log .Fatal (err )
257- }
258243
259244 // files is a slice of *gitdiff.File describing the files changed in the patch
260245 // preamble is a string of the content of the patch before the first file
261- files , _ , err := gitdiff .Parse (patch )
246+ files , _ , err := gitdiff .Parse (resp .Body )
247+ defer resp .Body .Close ()
262248 if err != nil {
263249 log .Fatal (err )
264250 }
@@ -273,6 +259,13 @@ func runCheck(dir string, prog string) int {
273259 if err := gitdiff .Apply (& output , code , files [0 ]); err != nil {
274260 log .Fatal (err )
275261 }
262+ code .Close ()
263+
264+ err = os .WriteFile (rPath , output .Bytes (), 0644 )
265+ if err != nil {
266+ panic (err )
267+ }
268+
276269 computeUnitsInt = helpCheck (dir , prog , filePath , cdir , computeUnitsInt )
277270
278271 // Read the contents of the file into a byte slice
0 commit comments