Skip to content

Commit

Permalink
Use for range-over-integers
Browse files Browse the repository at this point in the history
Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Sep 5, 2024
1 parent d1532b6 commit 5ba99cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker/docker_image_src.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func makeBufferedNetworkReader(stream io.ReadCloser, nBuffers, bufferSize uint)
handleBufferedNetworkReader(&br)
}()

for i := uint(0); i < nBuffers; i++ {
for range nBuffers {
b := bufferedNetworkReaderBuffer{
data: make([]byte, bufferSize),
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/blobinfocache/internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func testGenericUncompressedDigest(t *testing.T, cache blobinfocache.BlobInfoCac
}

func testGenericRecordDigestUncompressedPair(t *testing.T, cache blobinfocache.BlobInfoCache2) {
for i := 0; i < 2; i++ { // Record the same data twice to ensure redundant writes don’t break things.
for range 2 { // Record the same data twice to ensure redundant writes don’t break things.
// Known compressed→uncompressed mapping
cache.RecordDigestUncompressedPair(digestCompressedA, digestUncompressed)
assert.Equal(t, digestUncompressed, cache.UncompressedDigest(digestCompressedA))
Expand All @@ -113,7 +113,7 @@ func testGenericUncompressedDigestForTOC(t *testing.T, cache blobinfocache.BlobI
}

func testGenericRecordTOCUncompressedPair(t *testing.T, cache blobinfocache.BlobInfoCache2) {
for i := 0; i < 2; i++ { // Record the same data twice to ensure redundant writes don’t break things.
for range 2 { // Record the same data twice to ensure redundant writes don’t break things.
// Known TOC→uncompressed mapping
cache.RecordTOCUncompressedPair(digestCompressedA, digestUncompressed)
assert.Equal(t, digestUncompressed, cache.UncompressedDigestForTOC(digestCompressedA))
Expand All @@ -125,7 +125,7 @@ func testGenericRecordTOCUncompressedPair(t *testing.T, cache blobinfocache.Blob

func testGenericRecordKnownLocations(t *testing.T, cache blobinfocache.BlobInfoCache2) {
transport := mocks.NameImageTransport("==BlobInfocache transport mock")
for i := 0; i < 2; i++ { // Record the same data twice to ensure redundant writes don’t break things.
for range 2 { // Record the same data twice to ensure redundant writes don’t break things.
for _, scopeName := range []string{"A", "B"} { // Run the test in two different scopes to verify they don't affect each other.
scope := types.BICTransportScope{Opaque: scopeName}
for _, digest := range []digest.Digest{digestCompressedA, digestCompressedB} { // Two different digests should not affect each other either.
Expand Down

0 comments on commit 5ba99cd

Please sign in to comment.