]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: drop PackageInternal.Fake
authorRuss Cox <rsc@golang.org>
Sun, 16 Jul 2017 14:17:37 +0000 (08:17 -0600)
committerRuss Cox <rsc@golang.org>
Tue, 3 Oct 2017 14:11:06 +0000 (14:11 +0000)
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/56282
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/test/test.go

index e1c9e01142067dcc96ed2d91859791973308f8ab..41aaf30f059d9ee94efd91439934500ba72ab235 100644 (file)
@@ -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 ../)
index 7572b07324d8fdc39bf1a5fbdf10ced46cf4a619..bdedd256511a7f775fd337363e6599f86e340e33 100644 (file)
@@ -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"
                }