Browse Source

Bug fixing

pull/103/head
Unknown 11 years ago
parent
commit
7230bcd33d
  1. 10
      cmd/bin.go
  2. 10
      cmd/build.go

10
cmd/bin.go

@ -149,8 +149,11 @@ func runBin(ctx *cli.Context) {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
binName += ".exe" binName += ".exe"
} }
if !com.IsFile(binName) { binPath := path.Join(doc.VENDOR, "src", pkgName, binName)
log.Error("bin", "Cannot continue command:") 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") 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") { if ctx.Bool("dir") {
movePath = ctx.Args()[1] movePath = ctx.Args()[1]
} }
err = os.Rename(binName, movePath+"/"+binName) os.Remove(movePath + "/" + binName)
err = os.Rename(binPath, movePath+"/"+binName)
if err != nil { if err != nil {
log.Error("bin", "Fail to move binary:") log.Error("bin", "Fail to move binary:")
log.Fatal("", "\t"+err.Error()) log.Fatal("", "\t"+err.Error())

10
cmd/build.go

@ -57,8 +57,8 @@ func runBuild(ctx *cli.Context) {
cmdArgs = append(cmdArgs, ctx.Args()...) cmdArgs = append(cmdArgs, ctx.Args()...)
err := execCmd(newGoPath, newCurPath, cmdArgs...) err := execCmd(newGoPath, newCurPath, cmdArgs...)
if err != nil { if err != nil {
log.Error("Build", "Fail to build program") log.Error("build", "fail to build program:")
log.Fatal("", err.Error()) log.Fatal("", "\t"+err.Error())
} }
if isWindowsXP { if isWindowsXP {
@ -67,13 +67,13 @@ func runBuild(ctx *cli.Context) {
if com.IsFile(path.Join(doc.VENDOR, "src", pkgName, binName)) { if com.IsFile(path.Join(doc.VENDOR, "src", pkgName, binName)) {
err = os.Rename(path.Join(doc.VENDOR, "src", pkgName, binName), binName) err = os.Rename(path.Join(doc.VENDOR, "src", pkgName, binName), binName)
if err != nil { if err != nil {
log.Error("Build", "Fail to move binary") log.Error("build", "fail to move binary:")
log.Fatal("", err.Error()) log.Fatal("", "\t"+err.Error())
} }
} else { } else {
log.Warn("No binary generated") log.Warn("No binary generated")
} }
} }
log.Success("SUCC", "Build", "Command execute successfully!") log.Success("SUCC", "build", "Command execute successfully!")
} }

Loading…
Cancel
Save