From 1bffbf4298b9b01d7e29430924ad4621be54fdc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 5 Aug 2023 00:50:11 +0200 Subject: [PATCH 1/2] Update to Go 1.19 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already require it, because docker/credential-helpers uses Go 1.19 os/exec.Cmd.Environ(). So make that official. > go mod tidy -go=1.19 Signed-off-by: Miloslav Trmač --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0e79a2722d..f88c9b759d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/containers/image/v5 -go 1.18 +go 1.19 require ( dario.cat/mergo v1.0.0 From 98c6ba9eb697c76a85f069eb72fe6aaacf791260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 5 Aug 2023 01:11:26 +0200 Subject: [PATCH 2/2] Use the Go 1.19 type-safe sync/atomic type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... which makes sure the value is not accessed directly. Should not change behavior (the new function calls the previous implementation internally). Signed-off-by: Miloslav Trmač --- storage/storage_dest.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/storage_dest.go b/storage/storage_dest.go index da2d1f4923..3130fbb922 100644 --- a/storage/storage_dest.go +++ b/storage/storage_dest.go @@ -57,7 +57,7 @@ type storageImageDestination struct { imageRef storageReference directory string // Temporary directory where we store blobs until Commit() time - nextTempFileID int32 // A counter that we use for computing filenames to assign to blobs + nextTempFileID atomic.Int32 // A counter that we use for computing filenames to assign to blobs manifest []byte // Manifest contents, temporary manifestDigest digest.Digest // Valid if len(manifest) != 0 signatures []byte // Signature contents, temporary @@ -154,7 +154,7 @@ func (s *storageImageDestination) Close() error { } func (s *storageImageDestination) computeNextBlobCacheFile() string { - return filepath.Join(s.directory, fmt.Sprintf("%d", atomic.AddInt32(&s.nextTempFileID, 1))) + return filepath.Join(s.directory, fmt.Sprintf("%d", s.nextTempFileID.Add(1))) } // PutBlobWithOptions writes contents of stream and returns data representing the result.