1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-11 14:39:28 +02:00

fix: mutex on checksum refresh

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos A Becker 2021-12-22 14:42:18 -03:00
parent 8e3fa2cb36
commit 114c980726
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -9,6 +9,7 @@ import (
"path/filepath"
"sort"
"strings"
"sync"
"github.com/apex/log"
"github.com/goreleaser/goreleaser/internal/artifact"
@ -18,7 +19,10 @@ import (
"github.com/goreleaser/goreleaser/pkg/context"
)
var errNoArtifacts = errors.New("there are no artifacts to sign")
var (
errNoArtifacts = errors.New("there are no artifacts to sign")
lock sync.Mutex
)
// Pipe for checksums.
type Pipe struct{}
@ -65,6 +69,8 @@ func (Pipe) Run(ctx *context.Context) error {
}
func refresh(ctx *context.Context, filepath string) error {
lock.Lock()
defer lock.Unlock()
filter := artifact.Or(
artifact.ByType(artifact.UploadableArchive),
artifact.ByType(artifact.UploadableBinary),
@ -132,7 +138,7 @@ func refresh(ctx *context.Context, filepath string) error {
}
func checksums(algorithm string, artifact *artifact.Artifact) (string, error) {
log.WithField("file", artifact.Name).Info("checksumming")
log.WithField("file", artifact.Name).Debug("checksumming")
sha, err := artifact.Checksum(algorithm)
if err != nil {
return "", err