Skip to content

Commit

Permalink
refactor (Session).isOutputFileExist
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Jan 6, 2025
1 parent a5776e0 commit 9602f4e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,13 @@ func (s Session) summary(loggers [LEVELS]*log.Logger) {

func (s Session) isOutputFileExist() (bool, error) {
stat, err := os.Stat(s.OutputName)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return false, nil
}
return false, err
if errors.Is(err, os.ErrNotExist) {
return false, nil
}
if stat.IsDir() {
if err == nil && stat.IsDir() {
return true, errors.Wrapf(os.ErrInvalid, "%q is a directory", s.OutputName)
}
return true, nil
return true, err
}

func (s Session) checkContentSums(other Session) error {
Expand Down

0 comments on commit 9602f4e

Please sign in to comment.