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" {
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())

10
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!")
}

Loading…
Cancel
Save