Skip to content

Commit df0cd3c

Browse files
committed
modified to fix linter issues
1 parent f3b34c4 commit df0cd3c

File tree

1 file changed

+22
-17
lines changed
  • kustomize/commands/internal/util

1 file changed

+22
-17
lines changed

kustomize/commands/internal/util/util.go

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,28 @@ func GlobPatternsWithLoader(fSys filesys.FileSystem, ldr ifc.Loader, patterns []
4040
for _, pattern := range patterns {
4141
if skipValidation {
4242
result = append(result, pattern)
43-
} else {
44-
files, err := fSys.Glob(pattern)
45-
if err != nil {
46-
return nil, err
47-
}
48-
if len(files) != 0 {
49-
result = append(result, files...)
50-
} else {
51-
loader, err := ldr.New(pattern)
52-
if err != nil {
53-
return nil, fmt.Errorf("%s has no match: %w", pattern, err)
54-
} else {
55-
result = append(result, pattern)
56-
if loader != nil {
57-
loader.Cleanup()
58-
}
59-
}
43+
continue
44+
}
45+
46+
files, err := fSys.Glob(pattern)
47+
if err != nil {
48+
return nil, fmt.Errorf("error on checking the filesystem: %w", err)
49+
}
50+
51+
if len(files) != 0 {
52+
result = append(result, files...)
53+
continue
54+
}
55+
56+
loader, err := ldr.New(pattern)
57+
if err != nil {
58+
return nil, fmt.Errorf("%s has no match: %w", pattern, err)
59+
}
60+
61+
result = append(result, pattern)
62+
if loader != nil {
63+
if err = loader.Cleanup(); err != nil {
64+
return nil, fmt.Errorf("error on cleaning up loader: %w", err)
6065
}
6166
}
6267
}

0 commit comments

Comments
 (0)