Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ace53bb

Browse files
committed
all: remove nil check for slices
Signed-off-by: Elena Morozova <[email protected]>
1 parent f1e5349 commit ace53bb

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

api/types/filters/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (filters Args) MatchKVList(field string, sources map[string]string) bool {
165165
return true
166166
}
167167

168-
if sources == nil || len(sources) == 0 {
168+
if len(sources) == 0 {
169169
return false
170170
}
171171

pkg/archive/archive_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi os
3636
if err != nil {
3737
return err
3838
}
39-
if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' {
39+
if len(opaque) == 1 && opaque[0] == 'y' {
4040
// create a header for the whiteout file
4141
// it should inherit some properties from the parent, but be a regular file
4242
*hdr = tar.Header{

pkg/archive/changes_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) {
302302
if err != nil {
303303
return "", err
304304
}
305-
if opaque != nil && len(opaque) == 1 && opaque[0] == 'y' {
305+
if len(opaque) == 1 && opaque[0] == 'y' {
306306
return path, nil
307307
}
308308
}

pkg/discovery/backends.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func ParseAdvertise(advertise string) (string, error) {
6969
return "", fmt.Errorf("unable to get advertise IP address from interface (%s) : %v", advertise, err)
7070
}
7171

72-
if addrs == nil || len(addrs) == 0 {
72+
if len(addrs) == 0 {
7373
return "", fmt.Errorf("no available advertise IP address in interface (%s)", advertise)
7474
}
7575

0 commit comments

Comments
 (0)