1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-15 01:34:21 +02:00

refactor: remove unneeded in Go 1.22 loop var copy (#4856)

The PR cleans up unnecessary loop variable copying and enables the
[`copyloopvar`](https://golangci-lint.run/usage/linters/#copyloopvar)
linter for detecting this redundant variable copying.

#### Additional notes

After the project upgraded to Go version 1.22 in #4779, copying
variables inside a `for` loop became unnecessary. See this [blog
post](https://go.dev/blog/loopvar-preview) for a detailed explanation.

The `copyloopvar` linter is only available from `golangci-lint` v1.57
onwards, so we also need to update this tool.
This commit is contained in:
Oleksandr Redko
2024-05-12 19:21:13 +03:00
committed by GitHub
parent c5204dfb64
commit 00a376cc64
28 changed files with 3 additions and 43 deletions

View File

@ -137,7 +137,6 @@ func doUpload(ctx *context.Context, conf config.Blob) error {
g := semerrgroup.New(ctx.Parallelism)
for _, artifact := range ctx.Artifacts.Filter(filter).List() {
artifact := artifact
g.Go(func() error {
// TODO: replace this with ?prefix=folder on the bucket url
dataFile := artifact.Path
@ -152,8 +151,6 @@ func doUpload(ctx *context.Context, conf config.Blob) error {
return err
}
for name, fullpath := range files {
name := name
fullpath := fullpath
g.Go(func() error {
uploadFile := path.Join(dir, name)
return uploadData(ctx, conf, up, fullpath, uploadFile, bucketURL)