1
0
mirror of https://github.com/golang/go synced 2024-11-24 09:00:13 -07:00

cmd/go: improve stale reason for packages

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>
This commit is contained in:
Lynn Boger 2017-02-14 12:30:53 -05:00 committed by Ian Lance Taylor
parent c05b06a12d
commit 2ac32b6360

View File

@ -1507,7 +1507,13 @@ func isStale(p *Package) (bool, string) {
// Package is stale if a dependency is. // Package is stale if a dependency is.
for _, p1 := range p.Internal.Deps { for _, p1 := range p.Internal.Deps {
if p1.Stale { 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. // Package is stale if a dependency is, or if a dependency is newer.
for _, p1 := range p.Internal.Deps { for _, p1 := range p.Internal.Deps {
if p1.Internal.Target != "" && olderThan(p1.Internal.Target) { 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) 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 { for _, src := range srcs {
if olderThan(filepath.Join(p.Dir, src)) { 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
} }
} }