Browse code

all: remove nil check for slices

Signed-off-by: Elena Morozova <lelenanam@gmail.com>

Elena Morozova authored on 2016/10/14 05:55:38
Showing 4 changed files
... ...
@@ -165,7 +165,7 @@ func (filters Args) MatchKVList(field string, sources map[string]string) bool {
165 165
 		return true
166 166
 	}
167 167
 
168
-	if sources == nil || len(sources) == 0 {
168
+	if len(sources) == 0 {
169 169
 		return false
170 170
 	}
171 171
 
... ...
@@ -36,7 +36,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os
36 36
 		if err != nil {
37 37
 			return err
38 38
 		}
39
-		if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' {
39
+		if len(opaque) == 1 && opaque[0] == 'y' {
40 40
 			// create a header for the whiteout file
41 41
 			// it should inherit some properties from the parent, but be a regular file
42 42
 			*hdr = tar.Header{
... ...
@@ -302,7 +302,7 @@ func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) {
302 302
 		if err != nil {
303 303
 			return "", err
304 304
 		}
305
-		if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' {
305
+		if len(opaque) == 1 && opaque[0] == 'y' {
306 306
 			return path, nil
307 307
 		}
308 308
 	}
... ...
@@ -69,7 +69,7 @@ func ParseAdvertise(advertise string) (string, error) {
69 69
 		return "", fmt.Errorf("unable to get advertise IP address from interface (%s) : %v", advertise, err)
70 70
 	}
71 71
 
72
-	if addrs == nil || len(addrs) == 0 {
72
+	if len(addrs) == 0 {
73 73
 		return "", fmt.Errorf("no available advertise IP address in interface (%s)", advertise)
74 74
 	}
75 75