Skip to content

Commit

Permalink
Remove unnecessary copy
Browse files Browse the repository at this point in the history
Newer Go versions copy range iteration values in loops implicitly
  • Loading branch information
mholt committed Nov 21, 2024
1 parent ab120f0 commit d31bca9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion 7z.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func (z SevenZip) Extract(ctx context.Context, sourceArchive io.Reader, handleFi
skipDirs := skipList{}

for i, f := range zr.File {
f := f // make a copy for the Open closure
if err := ctx.Err(); err != nil {
return err // honor context cancellation
}
Expand Down
1 change: 0 additions & 1 deletion zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ func (z Zip) Extract(ctx context.Context, sourceArchive io.Reader, handleFile Fi
skipDirs := skipList{}

for i, f := range zr.File {
f := f // make a copy for the Open closure
if err := ctx.Err(); err != nil {
return err // honor context cancellation
}
Expand Down

0 comments on commit d31bca9

Please sign in to comment.