diff --git a/cmd/build.go b/cmd/build.go index e0ec71ce2..8ebb4439f 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -64,10 +64,14 @@ func runBuild(ctx *cli.Context) { if isWindowsXP { binName := pkgName + ".exe" os.Remove(binName) - err = os.Rename(path.Join(doc.VENDOR, "src", pkgName, binName), binName) - if err != nil { - log.Error("Build", "Fail to move binary") - log.Fatal("", err.Error()) + if com.IsFile(path.Join(doc.VENDOR, "src", pkgName, binName)) { + err = os.Rename(path.Join(doc.VENDOR, "src", pkgName, binName), binName) + if err != nil { + log.Error("Build", "Fail to move binary") + log.Fatal("", err.Error()) + } + } else { + log.Warn("No binary generated") } } diff --git a/log/log.go b/log/log.go index 07d2be159..2b1f1c9f0 100644 --- a/log/log.go +++ b/log/log.go @@ -36,6 +36,11 @@ func Fatal(hl, msg string) { os.Exit(2) } +func Warn(format string, args ...interface{}) { + fmt.Printf("gopm %s %s\n", brush.Purple("WARN"), + fmt.Sprintf(format, args...)) +} + func Log(format string, args ...interface{}) { fmt.Printf("gopm %s %s\n", brush.White("INFO"), fmt.Sprintf(format, args...)) diff --git a/log/log_windows.go b/log/log_windows.go index 5650bb0d3..6d8196d7f 100644 --- a/log/log_windows.go +++ b/log/log_windows.go @@ -32,6 +32,10 @@ func Fatal(hl, msg string) { os.Exit(2) } +func Warn(format string, args ...interface{}) { + fmt.Printf("gopm WARN %s\n", fmt.Sprintf(format, args...)) +} + func Log(format string, args ...interface{}) { fmt.Printf("gopm INFO %s\n", fmt.Sprintf(format, args...)) }