diff --git a/pkg/archive/archive.go b/pkg/archive/archive.go index f521388d1f..194d76a8c7 100644 --- a/pkg/archive/archive.go +++ b/pkg/archive/archive.go @@ -145,7 +145,7 @@ func DetectCompression(source []byte) Compression { logrus.Debug("Len too short") continue } - if bytes.Compare(m, source[:len(m)]) == 0 { + if bytes.Equal(m, source[:len(m)]) { return compression } } diff --git a/pkg/archive/archive_unix.go b/pkg/archive/archive_unix.go index d94858887d..68d3c97d27 100644 --- a/pkg/archive/archive_unix.go +++ b/pkg/archive/archive_unix.go @@ -107,10 +107,7 @@ func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { mode |= syscall.S_IFIFO } - if err := system.Mknod(path, mode, int(system.Mkdev(hdr.Devmajor, hdr.Devminor))); err != nil { - return err - } - return nil + return system.Mknod(path, mode, int(system.Mkdev(hdr.Devmajor, hdr.Devminor))) } func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { diff --git a/pkg/archive/changes.go b/pkg/archive/changes.go index c07d55cbd9..ca2c0ca1bf 100644 --- a/pkg/archive/changes.go +++ b/pkg/archive/changes.go @@ -267,7 +267,7 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) { } for name, newChild := range info.children { - oldChild, _ := oldChildren[name] + oldChild := oldChildren[name] if oldChild != nil { // change? oldStat := oldChild.stat @@ -279,7 +279,7 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) { // breaks down is if some code intentionally hides a change by setting // back mtime if statDifferent(oldStat, newStat) || - bytes.Compare(oldChild.capability, newChild.capability) != 0 { + !bytes.Equal(oldChild.capability, newChild.capability) { change := Change{ Path: newChild.path(), Kind: ChangeModify, diff --git a/pkg/chrootarchive/archive_test.go b/pkg/chrootarchive/archive_test.go index d2d7e621f5..80e54a0edc 100644 --- a/pkg/chrootarchive/archive_test.go +++ b/pkg/chrootarchive/archive_test.go @@ -77,7 +77,7 @@ func TestChrootUntarWithHugeExcludesList(t *testing.T) { options := &archive.TarOptions{} //65534 entries of 64-byte strings ~= 4MB of environment space which should overflow //on most systems when passed via environment or command line arguments - excludes := make([]string, 65534, 65534) + excludes := make([]string, 65534) for i := 0; i < 65534; i++ { excludes[i] = strings.Repeat(string(i), 64) }