| |
@@ -208,7 +208,7 @@
|
| |
var err error
|
| |
|
| |
// Get provided packages
|
| |
- if data.Packages, err = p.BuildPackageTree(false, false); err != nil {
|
| |
+ if data.Packages, err = p.BuildPackageTree(false, false, false); err != nil {
|
| |
return nil, err
|
| |
}
|
| |
sort.Strings(data.Packages)
|
| |
@@ -285,13 +285,15 @@
|
| |
return resources, nil
|
| |
}
|
| |
|
| |
- func (p *PackageInfoCollector) CollectProjectDeps(standard bool, skipSelf bool, tests bool) ([]string, error) {
|
| |
+ func (p *PackageInfoCollector) CollectProjectDeps(standard, skipSelf, withTests, testsOnly bool) ([]string, error) {
|
| |
imports := make(map[string]struct{})
|
| |
|
| |
for _, info := range p.packageInfos {
|
| |
var pkgImports []string
|
| |
- if tests {
|
| |
+ if testsOnly {
|
| |
pkgImports = info.TestImports
|
| |
+ } else if withTests {
|
| |
+ pkgImports = append(info.Imports, info.TestImports...)
|
| |
} else {
|
| |
pkgImports = info.Imports
|
| |
}
|
| |
@@ -331,16 +333,24 @@
|
| |
return pkgs, nil
|
| |
}
|
| |
|
| |
- func (p *PackageInfoCollector) BuildPackageTree(includeMain bool, tests bool) ([]string, error) {
|
| |
+ func (p *PackageInfoCollector) BuildPackageTree(includeMain, withTests, testsOnly bool) ([]string, error) {
|
| |
// TODO(jchaloup): strip all main package unless explicitely requested
|
| |
var entryPoints []string
|
| |
- if tests {
|
| |
+ if testsOnly {
|
| |
for p, pkgInfo := range p.packageInfos {
|
| |
if len(pkgInfo.TestGoFiles) > 0 {
|
| |
entryPoints = append(entryPoints, p)
|
| |
}
|
| |
}
|
| |
} else {
|
| |
+ if withTests {
|
| |
+ for p, pkgInfo := range p.packageInfos {
|
| |
+ if len(pkgInfo.TestGoFiles) > 0 {
|
| |
+ entryPoints = append(entryPoints, p)
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
for pkgName, pkgInfo := range p.packageInfos {
|
| |
// check package name of each file
|
| |
var nonMainFiles []string
|
| |
Fixes #3.
@nim