diff --git a/Commands/StartBackupProc.go b/Commands/StartBackupProc.go index 58e82ff..0cb6c25 100644 --- a/Commands/StartBackupProc.go +++ b/Commands/StartBackupProc.go @@ -78,6 +78,7 @@ func getTimeSuffix() string { return "_" + currTime.Format("02-01-2006_15-04") } +// skipcq: RVV-A0005 func checkTmpPath(createLocalBackup bool, targetPath string) string { logger := Logging.DetailedLogger("mainThread", "checkTmpPath") if !createLocalBackup { diff --git a/Compressor/Compression.go b/Compressor/Compression.go index eba1707..b11bac0 100644 --- a/Compressor/Compression.go +++ b/Compressor/Compression.go @@ -19,21 +19,18 @@ func CreateBakFile(fileName string, folderPath string, destinationPath string, b pathToFile := destinationPath + string(os.PathSeparator) + fileName + ".bak" - fileToWrite, err := os.OpenFile(pathToFile, os.O_CREATE|os.O_RDWR, os.FileMode(0775)) if err != nil { logger.Fatal(err) } compress(fileToWrite, folderPath, backupName) - SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, backupName, SQL.SQLStage_Compress, SQL.REMOTE_NONE, "File successfully written.", time.Now()) - return pathToFile } -func compress(fileToWrite *os.File, folderPath string, backupName string){ +func compress(fileToWrite *os.File, folderPath string, backupName string) { logger := Logging.DetailedLogger("Gzip", "compress") zr, _ := gzip.NewWriterLevel(fileToWrite, flate.BestCompression) @@ -41,6 +38,7 @@ func compress(fileToWrite *os.File, folderPath string, backupName string){ go fmt.Printf("[%s] Start compression...\n", backupName) SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, backupName, SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Start compression", time.Now()) + // skippcq: SCC-SA4009 filepath.Walk(folderPath, func(file string, fi os.FileInfo, err error) error { header, err := tar.FileInfoHeader(fi, file) if err != nil { @@ -54,7 +52,7 @@ func compress(fileToWrite *os.File, folderPath string, backupName string){ logger.Fatal(err) } - if !fi.IsDir(){ + if !fi.IsDir() { data, err := os.Open(file) if err != nil { logger.Fatal(err) @@ -77,7 +75,6 @@ func compress(fileToWrite *os.File, folderPath string, backupName string){ logger.Fatal(err) } - go fmt.Printf("[%s] Compression Done.\n", backupName) SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, backupName, SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Compression complete.", time.Now()) -} \ No newline at end of file +}