From 7230bcd33d013099300fba447c211ab9d9239746 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 5 Dec 2013 05:45:03 -0500 Subject: [PATCH] Bug fixing --- cmd/bin.go | 10 +++++++--- cmd/build.go | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd/bin.go b/cmd/bin.go index 2a21c189c..513febc8c 100644 --- a/cmd/bin.go +++ b/cmd/bin.go @@ -149,8 +149,11 @@ func runBin(ctx *cli.Context) { if runtime.GOOS == "windows" { binName += ".exe" } - if !com.IsFile(binName) { - log.Error("bin", "Cannot continue command:") + binPath := path.Join(doc.VENDOR, "src", pkgName, binName) + fmt.Println(binPath) + if !com.IsFile(binPath) { + log.Error("bin", "Binary does not exist:") + log.Error("", "\t"+binPath) log.Fatal("", "\tPrevious steps weren't successful or the project does not contain main package") } @@ -159,7 +162,8 @@ func runBin(ctx *cli.Context) { if ctx.Bool("dir") { movePath = ctx.Args()[1] } - err = os.Rename(binName, movePath+"/"+binName) + os.Remove(movePath + "/" + binName) + err = os.Rename(binPath, movePath+"/"+binName) if err != nil { log.Error("bin", "Fail to move binary:") log.Fatal("", "\t"+err.Error()) diff --git a/cmd/build.go b/cmd/build.go index 8ebb4439f..d275f86e9 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -57,8 +57,8 @@ func runBuild(ctx *cli.Context) { cmdArgs = append(cmdArgs, ctx.Args()...) err := execCmd(newGoPath, newCurPath, cmdArgs...) if err != nil { - log.Error("Build", "Fail to build program") - log.Fatal("", err.Error()) + log.Error("build", "fail to build program:") + log.Fatal("", "\t"+err.Error()) } if isWindowsXP { @@ -67,13 +67,13 @@ func runBuild(ctx *cli.Context) { 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()) + log.Error("build", "fail to move binary:") + log.Fatal("", "\t"+err.Error()) } } else { log.Warn("No binary generated") } } - log.Success("SUCC", "Build", "Command execute successfully!") + log.Success("SUCC", "build", "Command execute successfully!") }