From ace53bbe65d1384893027d046a5d4eae83bd60af Mon Sep 17 00:00:00 2001 From: Elena Morozova Date: Thu, 13 Oct 2016 13:55:38 -0700 Subject: [PATCH] all: remove nil check for slices Signed-off-by: Elena Morozova --- api/types/filters/parse.go | 2 +- pkg/archive/archive_linux.go | 2 +- pkg/archive/changes_linux.go | 2 +- pkg/discovery/backends.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/types/filters/parse.go b/api/types/filters/parse.go index 12e5a3b0d5..b0aa824618 100644 --- a/api/types/filters/parse.go +++ b/api/types/filters/parse.go @@ -165,7 +165,7 @@ func (filters Args) MatchKVList(field string, sources map[string]string) bool { return true } - if sources == nil || len(sources) == 0 { + if len(sources) == 0 { return false } diff --git a/pkg/archive/archive_linux.go b/pkg/archive/archive_linux.go index 5ec3ae1622..7426d725d5 100644 --- a/pkg/archive/archive_linux.go +++ b/pkg/archive/archive_linux.go @@ -36,7 +36,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os if err != nil { return err } - if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' { + if len(opaque) == 1 && opaque[0] == 'y' { // create a header for the whiteout file // it should inherit some properties from the parent, but be a regular file *hdr = tar.Header{ diff --git a/pkg/archive/changes_linux.go b/pkg/archive/changes_linux.go index a4cc0c65d3..fc5a9dfdb9 100644 --- a/pkg/archive/changes_linux.go +++ b/pkg/archive/changes_linux.go @@ -302,7 +302,7 @@ func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) { if err != nil { return "", err } - if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' { + if len(opaque) == 1 && opaque[0] == 'y' { return path, nil } } diff --git a/pkg/discovery/backends.go b/pkg/discovery/backends.go index 10febb5442..c09d9a1316 100644 --- a/pkg/discovery/backends.go +++ b/pkg/discovery/backends.go @@ -69,7 +69,7 @@ func ParseAdvertise(advertise string) (string, error) { return "", fmt.Errorf("unable to get advertise IP address from interface (%s) : %v", advertise, err) } - if addrs == nil || len(addrs) == 0 { + if len(addrs) == 0 { return "", fmt.Errorf("no available advertise IP address in interface (%s)", advertise) }