Replace log with glog.

Show log messages to users is unnecessary. It is only for
debugging purposes.
pull/6/head
Madhusudan.C.S 2016-05-10 15:51:15 -07:00
parent dd154350e8
commit 704ef5bb6e
1 changed files with 8 additions and 7 deletions

View File

@ -26,11 +26,12 @@ import (
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
"path/filepath"
"time"
"github.com/golang/glog"
)
const usageHelp = "" +
@ -115,13 +116,13 @@ func (p *pkg) isNewerThan(buildTime time.Time) bool {
// Test for file staleness
for _, f := range p.TestGoFiles {
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
}
}
for _, f := range p.XTestGoFiles {
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
}
}
@ -138,13 +139,13 @@ func (p *pkg) isNewerThan(buildTime time.Time) bool {
// dependencies.
pkgs, err := pkgInfo(imps)
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
}
for _, p := range pkgs {
if p.Stale {
log.Printf("import %q is stale", p.ImportPath)
glog.V(4).Infof("import %q is stale", p.ImportPath)
return true
}
}
@ -165,14 +166,14 @@ func isNewerThan(filename string, buildTime time.Time) bool {
func isTestStale(binPath, pkgPath string) bool {
bStat, err := os.Stat(binPath)
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
}
buildTime := bStat.ModTime()
pkgs, err := pkgInfo([]string{pkgPath})
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
}