From e7bd7b59bc835dd16e3f8caa704a244c7640c4fd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Apr 10 2019 09:56:42 +0000 Subject: Shorten file collection code. --- diff --git a/pkg/util/util.go b/pkg/util/util.go index 136a017..1f6d2d7 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -259,46 +259,17 @@ func (p *PackageInfoCollector) CollectInstalledResources() ([]string, error) { for _, info := range p.packageInfos { resources = append(resources, info.Dir) - for _, file := range info.GoFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.CgoFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.CFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.CXXFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.MFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.HFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.FFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.SFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.SwigFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.SwigCXXFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.SysoFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.TestGoFiles { - resources = append(resources, path.Join(info.Dir, file)) - } - for _, file := range info.XTestGoFiles { - resources = append(resources, path.Join(info.Dir, file)) - } + allFileLists := [][]string{ + info.GoFiles, info.CgoFiles, + info.CFiles, info.CXXFiles, info.MFiles, info.HFiles, info.FFiles, + info.SFiles, info.SwigFiles, info.SwigCXXFiles, info.SysoFiles, + info.TestGoFiles, info.XTestGoFiles} + for _, fileList := range allFileLists { + for _, file := range fileList { + resources = append(resources, path.Join(info.Dir, file)) + } + } } if p.otherResources.ProtoFiles != nil {