AllGoFiles []string // gofiles + IgnoredGoFiles, absolute paths
Target string // installed file for this package (may be executable)
Pkgfile string // where package will be (or is already) built or installed
- Fake bool // synthesized package
ForceLibrary bool // this package is a library (even if named "main")
Cmdline bool // defined by files listed on command line
Local bool // imported via local path (./ or ../)
}
p.Stale = true // rebuild
p.StaleReason = "rebuild for coverage"
- p.Internal.Fake = true // do not warn about rebuild
p.Internal.CoverMode = testCoverMode
var coverFiles []string
coverFiles = append(coverFiles, p.GoFiles...)
}
}
- // If we are building any out-of-date packages other
- // than those under test, warn.
- okBuild := map[*load.Package]bool{}
- for _, p := range pkgs {
- okBuild[p] = true
- }
- warned := false
- for _, a := range work.ActionList(root) {
- if a.Package == nil || okBuild[a.Package] {
- continue
- }
- okBuild[a.Package] = true // warn at most once
-
- // Don't warn about packages being rebuilt because of
- // things like coverage analysis.
- for _, p1 := range a.Package.Internal.Imports {
- if p1.Internal.Fake {
- a.Package.Internal.Fake = true
- }
- }
-
- if a.Func != nil && !okBuild[a.Package] && !a.Package.Internal.Fake && !a.Package.Internal.Local {
- if !warned {
- fmt.Fprintf(os.Stderr, "warning: building out-of-date packages:\n")
- warned = true
- }
- fmt.Fprintf(os.Stderr, "\t%s\n", a.Package.ImportPath)
- }
- }
- if warned {
- args := strings.Join(pkgArgs, " ")
- if args != "" {
- args = " " + args
- }
- extraOpts := ""
- if cfg.BuildRace {
- extraOpts = "-race "
- }
- if cfg.BuildMSan {
- extraOpts = "-msan "
- }
- fmt.Fprintf(os.Stderr, "installing these packages with 'go test %s-i%s' will speed future tests.\n\n", extraOpts, args)
- }
-
b.Do(root)
}
ptest.Internal.Target = ""
ptest.Imports = str.StringList(p.Imports, p.TestImports)
ptest.Internal.Imports = append(append([]*load.Package{}, p.Internal.Imports...), imports...)
- ptest.Internal.Fake = true
ptest.Internal.ForceLibrary = true
ptest.Stale = true
ptest.StaleReason = "rebuild for test"
ImportPos: p.Internal.Build.XTestImportPos,
},
Imports: ximports,
- Fake: true,
},
}
if pxtestNeedsPtest {
},
Internal: load.PackageInternal{
Build: &build.Package{Name: "main"},
- Fake: true,
OmitDebug: !testC && !testNeedBinary,
},
}
copy(p1.Internal.Imports, p.Internal.Imports)
p = p1
p.Internal.Target = ""
- p.Internal.Fake = true
p.Stale = true
p.StaleReason = "depends on package being tested"
}