Remove dead code

Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
David Gageot 2022-10-07 18:46:38 +02:00
parent 07adfa2bb8
commit d7ec2209b1
No known key found for this signature in database
GPG Key ID: 93C3F22BE5D3A40B
3 changed files with 0 additions and 59 deletions

View File

@ -1,22 +0,0 @@
package cache
import (
"io"
)
type nopCloserWriter struct {
writer io.Writer
}
func (n nopCloserWriter) Write(b []byte) (int, error) {
return n.writer.Write(b)
}
func (n nopCloserWriter) Close() error {
return nil
}
// NopCloserWriter wrap an io.Writer with a no-op Closer
func NopCloserWriter(writer io.Writer) io.WriteCloser {
return nopCloserWriter{writer}
}

View File

@ -94,24 +94,6 @@ func copyTarEntry(w *Writer, thdr *tar.Header, r io.Reader) (written int64, err
return
}
// CopyTar copies a tar stream into an initrd
func CopyTar(w *Writer, r *tar.Reader) (written int64, err error) {
for {
var thdr *tar.Header
thdr, err = r.Next()
if err == io.EOF {
return written, nil
}
if err != nil {
return
}
written, err = copyTarEntry(w, thdr, r)
if err != nil {
return
}
}
}
// CopySplitTar copies a tar stream into an initrd, but splits out kernel, cmdline, and ucode
func CopySplitTar(w *Writer, r *tar.Reader) (kernel []byte, cmdline string, ucode []byte, err error) {
for {
@ -188,10 +170,3 @@ func (w *Writer) Close() error {
}
return nil
}
// Copy reads a tarball in a stream and outputs a compressed init ram disk
func Copy(w *Writer, r io.Reader) (int64, error) {
tr := tar.NewReader(r)
return CopyTar(w, tr)
}

View File

@ -24,18 +24,6 @@ import (
var imagesBytes []byte
var outputImages map[string]string
// UpdateOutputImages overwrite the docker images used to build the outputs
// 'update' is a map where the key is the output format and the value is a LinuxKit 'mkimage' image.
func UpdateOutputImages(update map[string]string) error {
for k, img := range update {
if _, ok := outputImages[k]; !ok {
return fmt.Errorf("Image format %s is not known", k)
}
outputImages[k] = img
}
return nil
}
var outFuns = map[string]func(string, io.Reader, int) error{
"kernel+initrd": func(base string, image io.Reader, size int) error {
kernel, initrd, cmdline, ucode, err := tarToInitrd(image)