Skip to content

Commit 4c9b11f

Browse files
committed
move readCloserWrapper to be a test-utility
It's only used in tests now, so move it there. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 8329295 commit 4c9b11f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Diff for: archive.go

-12
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,6 @@ func DetectCompression(source []byte) compression.Compression {
132132
return compression.Detect(source)
133133
}
134134

135-
type readCloserWrapper struct {
136-
io.Reader
137-
closer func() error
138-
}
139-
140-
func (r *readCloserWrapper) Close() error {
141-
if r.closer != nil {
142-
return r.closer()
143-
}
144-
return nil
145-
}
146-
147135
// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.
148136
//
149137
// Deprecated: use [compression.DecompressStream].

Diff for: diff_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,18 @@ func TestApplyLayerWhiteouts(t *testing.T) {
310310
}
311311
}
312312

313+
type readCloserWrapper struct {
314+
io.Reader
315+
closer func() error
316+
}
317+
318+
func (r *readCloserWrapper) Close() error {
319+
if r.closer != nil {
320+
return r.closer()
321+
}
322+
return nil
323+
}
324+
313325
func makeTestLayer(paths []string) (_ io.ReadCloser, retErr error) {
314326
tmpDir, err := os.MkdirTemp("", "graphdriver-test-mklayer")
315327
if err != nil {

0 commit comments

Comments
 (0)