Pass nil instead of []string{} to ctx.Glob* functions
[]string{} is unnecessary, just use nil.
Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: Ia9aeb2ffc483429787da0e473a7f1bc87eb4cad1
diff --git a/android/module.go b/android/module.go
index fe6c0de..07c4e8f 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1177,7 +1177,10 @@
func (ctx *androidModuleContext) ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths {
prefix := PathForModuleSrc(ctx).String()
- expandedExcludes := make([]string, 0, len(excludes))
+ var expandedExcludes []string
+ if excludes != nil {
+ expandedExcludes = make([]string, 0, len(excludes))
+ }
for _, e := range excludes {
if m := SrcIsModule(e); m != "" {
diff --git a/android/paths.go b/android/paths.go
index 3d4d3f3..fa2e10e 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -269,7 +269,7 @@
// Use Glob so that if the default doesn't exist, a dependency is added so that when it
// is created, we're run again.
path := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir(), def)
- return ctx.Glob(path, []string{})
+ return ctx.Glob(path, nil)
}
// Strings returns the Paths in string form
@@ -635,7 +635,7 @@
if pathtools.IsGlob(dir) {
reportPathErrorf(ctx, "Path may not contain a glob: %s", dir)
}
- paths, err := ctx.GlobWithDeps(dir, []string{})
+ paths, err := ctx.GlobWithDeps(dir, nil)
if err != nil {
reportPathErrorf(ctx, "glob: %s", err.Error())
return OptionalPath{}