Skip to content

Commit 64be664

Browse files
committed
cli/command/image/build: deprecate IsArchive utility
It was only used internally. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2c539a6 commit 64be664

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cli/command/image/build/context.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, ok bool, err er
108108
return nil, false, fmt.Errorf("failed to peek context header from STDIN: %w", err)
109109
}
110110

111-
return newReadCloserWrapper(buf, func() error { return input.Close() }), IsArchive(magic), nil
111+
return newReadCloserWrapper(buf, func() error { return input.Close() }), isArchive(magic), nil
112112
}
113113

114114
// WriteTempDockerfile writes a Dockerfile stream to a temporary file with a
@@ -178,7 +178,15 @@ func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadC
178178

179179
// IsArchive checks for the magic bytes of a tar or any supported compression
180180
// algorithm.
181+
//
182+
// Deprecated: this utility was used internally and will be removed in the next release.
181183
func IsArchive(header []byte) bool {
184+
return isArchive(header)
185+
}
186+
187+
// isArchive checks for the magic bytes of a tar or any supported compression
188+
// algorithm.
189+
func isArchive(header []byte) bool {
182190
if compression.Detect(header) != compression.None {
183191
return true
184192
}

cli/command/image/build/context_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func TestIsArchive(t *testing.T) {
291291
}
292292
for _, tc := range tests {
293293
t.Run(tc.doc, func(t *testing.T) {
294-
assert.Check(t, is.Equal(tc.expected, IsArchive(tc.header)), tc.doc)
294+
assert.Check(t, is.Equal(tc.expected, isArchive(tc.header)), tc.doc)
295295
})
296296
}
297297
}

0 commit comments

Comments
 (0)