Skip to content

Commit

Permalink
fix: refactor nested loop
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Tianchu Zhao <evantczhao@gmail.com>
  • Loading branch information
tczhao and agilgur5 authored Jun 2, 2024
1 parent 9b52ae9 commit 30b70c6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions workflow/artifacts/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,20 @@ func (s3Driver *ArtifactDriver) Delete(artifact *wfv1.Artifact) error {

if !isDir {
return s3cli.Delete(artifact.S3.Bucket, artifact.S3.Key)
} else {
keys, err := s3cli.ListDirectory(artifact.S3.Bucket, artifact.S3.Key)
}

keys, err := s3cli.ListDirectory(artifact.S3.Bucket, artifact.S3.Key)
if err != nil {
return fmt.Errorf("unable to list files in %s: %s", artifact.S3.Key, err)
}
for _, objKey := range keys {
err = s3cli.Delete(artifact.S3.Bucket, objKey)
if err != nil {
return fmt.Errorf("unable to list files in %s: %s", artifact.S3.Key, err)
}
for _, objKey := range keys {
err = s3cli.Delete(artifact.S3.Bucket, objKey)
if err != nil {
return err
}
return err
}
}
return nil
}

Check failure on line 203 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Unit Tests

syntax error: unexpected newline in argument list; possibly missing comma or )

Check failure on line 203 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected newline in argument list; possibly missing comma or )

Check failure on line 203 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected newline in argument list; possibly missing comma or )

Check failure on line 203 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

missing ',' before newline in argument list (typecheck)
return nil

Check failure on line 204 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Unit Tests

syntax error: unexpected return at end of statement

Check failure on line 204 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected return at end of statement

Check failure on line 204 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected return at end of statement
})

Check failure on line 205 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Unit Tests

syntax error: unexpected ) after top level declaration

Check failure on line 205 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected ) after top level declaration) (typecheck)

Check failure on line 205 in workflow/artifacts/s3/s3.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected ) after top level declaration (typecheck)

return err
Expand Down

0 comments on commit 30b70c6

Please sign in to comment.