TMP directory crud
	
		
			
	
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	
				
					
				
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	This commit is contained in:
		
							parent
							
								
									4a22420311
								
							
						
					
					
						commit
						c2f6cd46f2
					
				
							
								
								
									
										19
									
								
								main.go
								
								
								
								
							
							
						
						
									
										19
									
								
								main.go
								
								
								
								
							|  | @ -233,14 +233,23 @@ func filterDiffOutput(diffOutput, cname string, ignores []string) (string, error | |||
| } | ||||
| 
 | ||||
| func writeToFile(filename, content string) error { | ||||
| 	file, err := os.Create(filename) | ||||
| 	tempFile, err := os.CreateTemp("", "filtered_output") | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 		return fmt.Errorf("error creating temporary file: %s", err) | ||||
| 	} | ||||
| 	defer file.Close() | ||||
| 	defer os.Remove(tempFile.Name()) // Ensure the temporary file is removed
 | ||||
| 
 | ||||
| 	_, err = file.WriteString(content) | ||||
| 	return err | ||||
| 	_, err = tempFile.WriteString(content) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("error writing to temporary file: %s", err) | ||||
| 	} | ||||
| 
 | ||||
| 	err = copyFile(tempFile.Name(), filename) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("error copying temporary file to final destination: %s", err) | ||||
| 	} | ||||
| 
 | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func sendNotification(content string) error { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue