Enable exportloopref lint
Created by: camdencheek
This enables the exportloopref
lint, which checks for the footgun of capturing a reference to
the a loop variable. I figure if I still hit this even though I explicitly look for it when writing code and reviewing PRs, other people probably do too. After enabling, it exposed a few things that look like actual issues, so this PR also fixes those.
Test plan
Just adds a lint and fixes violations. I ran ./dev/golangci-lint.sh --config .golangci.yml run
to test it.