Browse Source

Merge pull request #27365 from morelena/remove_nil_check

all: remove nil check for slices
Aaron Lehmann 8 years ago
parent
commit
245bd4c3d2

+ 1 - 1
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
 	}
 

+ 1 - 1
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{

+ 1 - 1
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
 		}
 	}

+ 1 - 1
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)
 	}