Commit 6b4008db authored by Russ Cox's avatar Russ Cox

cmd/go: drop PackageInternal.Fake

The point of this code is to print a warning about repeated go test
invocations rebuilding the same packages over and over.
The new cache will eliminate this failure mode and with it
the need for the warning and this field.

Change-Id: Ied79b3ca67d51a61f44629de6ae4974e6c8dd5a9
Reviewed-on: https://go-review.googlesource.com/56282Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 9f52b5ab
......@@ -99,7 +99,6 @@ type PackageInternal struct {
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 ../)
......
......@@ -566,7 +566,6 @@ func runTest(cmd *base.Command, args []string) {
}
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...)
......@@ -627,50 +626,6 @@ func runTest(cmd *base.Command, args []string) {
}
}
// 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)
}
......@@ -789,7 +744,6 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
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"
......@@ -833,7 +787,6 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
ImportPos: p.Internal.Build.XTestImportPos,
},
Imports: ximports,
Fake: true,
},
}
if pxtestNeedsPtest {
......@@ -858,7 +811,6 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
},
Internal: load.PackageInternal{
Build: &build.Package{Name: "main"},
Fake: true,
OmitDebug: !testC && !testNeedBinary,
},
}
......@@ -1078,7 +1030,6 @@ func recompileForTest(pmain, preal, ptest *load.Package) {
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"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment