artefactual-sdps / enduro

A tool to support ingest and automation in digital preservation workflows
https://enduro.readthedocs.io/
Apache License 2.0
4 stars 3 forks source link

Remove extra loop var copies #852

Closed sevein closed 4 months ago

sevein commented 5 months ago

In preparation for the go1.22 release, this pull request removes the copy of the loop variable that we used to need to prevent sharing in per-iteration closures or goroutines. I haven't found yet a tool that can remove these automatically, for now I find them in vscode using \b(\w+)\s*:=\s*\1\b$. Or:

grep --recursive --include=\*.go --perl-regexp '\b(\w+)\s*:=\s*\1\b$' .

I'll keep this as a draft until go1.22 is released.

Context: https://go.dev/wiki/LoopvarExperiment.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (3c851dd) 45.30% compared to head (2ff601c) 45.29%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #852 +/- ## ========================================== - Coverage 45.30% 45.29% -0.02% ========================================== Files 93 93 Lines 5039 5036 -3 ========================================== - Hits 2283 2281 -2 + Misses 2553 2552 -1 Partials 203 203 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.