archive,cmd,images: clean up some code

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
This commit is contained in:
unclejack 2017-03-30 11:41:22 +03:00
parent e91d6805af
commit 7b4d238ee3
5 changed files with 5 additions and 11 deletions

View file

@ -60,7 +60,7 @@ func DetectCompression(source []byte) Compression {
// Len too short
continue
}
if bytes.Compare(m, source[:len(m)]) == 0 {
if bytes.Equal(m, source[:len(m)]) {
return compression
}
}

View file

@ -53,7 +53,7 @@ func testCompressDecompress(t *testing.T, size int, compression Compression) {
if err != nil {
t.Fatal(err)
}
if bytes.Compare(orig, decompressed) != 0 {
if !bytes.Equal(orig, decompressed) {
t.Fatal("strange decompressed data")
}
}

View file

@ -137,7 +137,7 @@ func main() {
// start the prometheus metrics API for containerd
serveMetricsAPI()
log.G(global).Infof("containerd successfully booted in %fs", time.Now().Sub(start).Seconds())
log.G(global).Infof("containerd successfully booted in %fs", time.Since(start).Seconds())
return handleSignals(signals, server)
}

6
cmd/dist/fetch.go vendored
View file

@ -212,11 +212,7 @@ func (j *jobs) jobs() []string {
defer j.mu.Unlock()
var jobs []string
for _, j := range j.refs {
jobs = append(jobs, j)
}
return jobs
return append(jobs, j.refs...)
}
type statusInfo struct {

View file

@ -137,9 +137,7 @@ func ChildrenHandler(provider content.Provider) HandlerFunc {
var descs []ocispec.Descriptor
descs = append(descs, manifest.Config)
for _, desc := range manifest.Layers {
descs = append(descs, desc)
}
descs = append(descs, manifest.Layers...)
return descs, nil
}