return
}
seen[p] = true
- for _, p1 := range p.deps {
+ for _, p1 := range p.imports {
walk(p1)
}
all = append(all, p)
// computeStale computes the Stale flag in the package dag that starts
// at the named pkgs (command-line arguments).
-func computeStale(pkgs []*Package) {
+func computeStale(pkgs ...*Package) {
topRoot := map[string]bool{}
for _, p := range pkgs {
topRoot[p.Root] = true
pkgs = append(pkgs, loadPackage(arg, &stk))
}
- computeStale(pkgs)
+ computeStale(pkgs...)
return pkgs
}
imports = append(imports, p1)
}
for _, path := range p.XTestImports {
+ if path == p.ImportPath {
+ continue
+ }
p1 := loadImport(path, p.Dir, &stk, p.build.XTestImportPos[path])
if p1.Error != nil {
return nil, nil, nil, p1.Error
ptest.imports = append(append([]*Package{}, p.imports...), imports...)
ptest.pkgdir = testDir
ptest.fake = true
+ ptest.Stale = true
ptest.build = new(build.Package)
*ptest.build = *p.build
m := map[string][]token.Position{}
m[k] = append(m[k], v...)
}
ptest.build.ImportPos = m
+ computeStale(ptest)
a := b.action(modeBuild, modeBuild, ptest)
a.objdir = testDir + string(filepath.Separator)
a.objpkg = ptestObj
imports: append(ximports, ptest),
pkgdir: testDir,
fake: true,
+ Stale: true,
}
+ computeStale(pxtest)
a := b.action(modeBuild, modeBuild, pxtest)
a.objdir = testDir + string(filepath.Separator)
a.objpkg = buildToolchain.pkgpath(testDir, pxtest)
// Action for building pkg.test.
pmain = &Package{
- Name: "main",
- Dir: testDir,
- GoFiles: []string{"_testmain.go"},
- imports: []*Package{ptest},
- build: &build.Package{},
- fake: true,
+ Name: "main",
+ Dir: testDir,
+ GoFiles: []string{"_testmain.go"},
+ ImportPath: "testmain",
+ imports: []*Package{ptest},
+ build: &build.Package{},
+ fake: true,
+ Stale: true,
}
if pxtest != nil {
pmain.imports = append(pmain.imports, pxtest)
return nil, nil, nil, pregexp.Error
}
pmain.imports = append(pmain.imports, ptesting, pregexp)
+ computeStale(pmain)
a := b.action(modeBuild, modeBuild, pmain)
a.objdir = testDir + string(filepath.Separator)