]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: improve stale reason for packages
authorLynn Boger <laboger@linux.vnet.ibm.com>
Tue, 14 Feb 2017 17:30:53 +0000 (12:30 -0500)
committerIan Lance Taylor <iant@golang.org>
Wed, 15 Feb 2017 21:02:28 +0000 (21:02 +0000)
This adds more information to the pkg stale reason for debugging
purposes.

Change-Id: I7b626db4520baa1127195ae859f4da9b49304636
Reviewed-on: https://go-review.googlesource.com/36944
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/internal/load/pkg.go

index bf91bb74ada5dd9112e4d2d63a86fd801a9c8738..9a24733768be3bc6084147cf6fee1bbfafee7223 100644 (file)
@@ -1507,7 +1507,13 @@ func isStale(p *Package) (bool, string) {
        // Package is stale if a dependency is.
        for _, p1 := range p.Internal.Deps {
                if p1.Stale {
-                       return true, "stale dependency"
+                       // Don't add "stale dependency" if it is
+                       // already there.
+                       if strings.HasPrefix(p1.StaleReason, "stale dependency") {
+                               return true, p1.StaleReason
+                       }
+                       msg := fmt.Sprintf("stale dependency %s: %s", p1.Name, p1.StaleReason)
+                       return true, msg
                }
        }
 
@@ -1545,7 +1551,8 @@ func isStale(p *Package) (bool, string) {
        // Package is stale if a dependency is, or if a dependency is newer.
        for _, p1 := range p.Internal.Deps {
                if p1.Internal.Target != "" && olderThan(p1.Internal.Target) {
-                       return true, "newer dependency"
+                       msg := fmt.Sprintf("newer dependency %s ", p1.Internal.Target)
+                       return true, msg
                }
        }
 
@@ -1612,7 +1619,8 @@ func isStale(p *Package) (bool, string) {
        srcs := str.StringList(p.GoFiles, p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.CgoFiles, p.SysoFiles, p.SwigFiles, p.SwigCXXFiles)
        for _, src := range srcs {
                if olderThan(filepath.Join(p.Dir, src)) {
-                       return true, "newer source file"
+                       msg := fmt.Sprintf("newer source file %s", filepath.Join(p.Dir, src))
+                       return true, msg
                }
        }