Skip to content

Commit

Permalink
Fix issues raised by linter
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Apr 26, 2024
1 parent 292d47e commit e613f60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 3 additions & 4 deletions cmd/backup/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import (
)

func createArchive(files []string, inputFilePath, outputFilePath string, compression string, compressionConcurrency int) error {
inputFilePath = stripTrailingSlashes(inputFilePath)
inputFilePath, outputFilePath, err := makeAbsolute(inputFilePath, outputFilePath)
_, outputFilePath, err := makeAbsolute(stripTrailingSlashes(inputFilePath), outputFilePath)
if err != nil {
return errwrap.Wrap(err, "error transposing given file paths")
}
if err := os.MkdirAll(filepath.Dir(outputFilePath), 0755); err != nil {
return errwrap.Wrap(err, "error creating output file path")
}

if err := compress(files, outputFilePath, filepath.Dir(inputFilePath), compression, compressionConcurrency); err != nil {
if err := compress(files, outputFilePath, compression, compressionConcurrency); err != nil {
return errwrap.Wrap(err, "error creating archive")
}

Expand All @@ -55,7 +54,7 @@ func makeAbsolute(inputFilePath, outputFilePath string) (string, string, error)
return inputFilePath, outputFilePath, err
}

func compress(paths []string, outFilePath, subPath string, algo string, concurrency int) error {
func compress(paths []string, outFilePath, algo string, concurrency int) error {
file, err := os.Create(outFilePath)
if err != nil {
return errwrap.Wrap(err, "error creating out file")
Expand Down
6 changes: 1 addition & 5 deletions cmd/backup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ func (c *command) schedule(strategy configStrategy) error {
c.logger.Warn(
fmt.Sprintf("Scheduled cron expression %s will never run, is this intentional?", config.BackupCronExpression),
)

if err != nil {
return errwrap.Wrap(err, "error scheduling")
}
c.schedules = append(c.schedules, id)
}
c.schedules = append(c.schedules, id)
}

return nil
Expand Down

0 comments on commit e613f60

Please sign in to comment.