Replace log with glog.

Show log messages to users is unnecessary. It is only for
debugging purposes.
This commit is contained in:
Madhusudan.C.S 2016-05-10 15:51:15 -07:00
parent dd154350e8
commit 704ef5bb6e

View File

@ -26,11 +26,12 @@ import (
"flag" "flag"
"fmt" "fmt"
"io" "io"
"log"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"time" "time"
"github.com/golang/glog"
) )
const usageHelp = "" + const usageHelp = "" +
@ -115,13 +116,13 @@ func (p *pkg) isNewerThan(buildTime time.Time) bool {
// Test for file staleness // Test for file staleness
for _, f := range p.TestGoFiles { for _, f := range p.TestGoFiles {
if isNewerThan(filepath.Join(p.Dir, f), buildTime) { if isNewerThan(filepath.Join(p.Dir, f), buildTime) {
log.Printf("test Go file %s is stale", f) glog.V(4).Infof("test Go file %s is stale", f)
return true return true
} }
} }
for _, f := range p.XTestGoFiles { for _, f := range p.XTestGoFiles {
if isNewerThan(filepath.Join(p.Dir, f), buildTime) { if isNewerThan(filepath.Join(p.Dir, f), buildTime) {
log.Printf("external test Go file %s is stale", f) glog.V(4).Infof("external test Go file %s is stale", f)
return true return true
} }
} }
@ -138,13 +139,13 @@ func (p *pkg) isNewerThan(buildTime time.Time) bool {
// dependencies. // dependencies.
pkgs, err := pkgInfo(imps) pkgs, err := pkgInfo(imps)
if err != nil || len(pkgs) < 1 { if err != nil || len(pkgs) < 1 {
log.Printf("failed to obtain metadata for packages %s: %v", imps, err) glog.V(4).Infof("failed to obtain metadata for packages %s: %v", imps, err)
return true return true
} }
for _, p := range pkgs { for _, p := range pkgs {
if p.Stale { if p.Stale {
log.Printf("import %q is stale", p.ImportPath) glog.V(4).Infof("import %q is stale", p.ImportPath)
return true return true
} }
} }
@ -165,14 +166,14 @@ func isNewerThan(filename string, buildTime time.Time) bool {
func isTestStale(binPath, pkgPath string) bool { func isTestStale(binPath, pkgPath string) bool {
bStat, err := os.Stat(binPath) bStat, err := os.Stat(binPath)
if err != nil { if err != nil {
log.Printf("Couldn't obtain the modified time of the binary %s: %v", binPath, err) glog.V(4).Infof("Couldn't obtain the modified time of the binary %s: %v", binPath, err)
return true return true
} }
buildTime := bStat.ModTime() buildTime := bStat.ModTime()
pkgs, err := pkgInfo([]string{pkgPath}) pkgs, err := pkgInfo([]string{pkgPath})
if err != nil || len(pkgs) < 1 { if err != nil || len(pkgs) < 1 {
log.Printf("Couldn't retrieve test package information for package %s: %v", pkgPath, err) glog.V(4).Infof("Couldn't retrieve test package information for package %s: %v", pkgPath, err)
return false return false
} }