Skip to content

Commit

Permalink
Corrects the binary output name
Browse files Browse the repository at this point in the history
  • Loading branch information
haroon-sheikh committed Oct 20, 2022
1 parent 596ebfb commit f201d57
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions build/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,30 @@ func mirrorDir(src, dst string) error {
return err
}

func runProcess(command string, workingDir string, arg ...string) {
func runProcess(command string, arg ...string) {
cmd := exec.Command(command, arg...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = workingDir
log.Printf("Execute %v\n", cmd.Args)
fmt.Printf("Execute %v\n", cmd.Args)
err := cmd.Run()
if err != nil {
panic(err)
}
}

func compileGoPackage() {
destDir := filepath.Join(bin, fmt.Sprintf("%s_%s", getGOOS(), getGOARCH()))
err := os.MkdirAll(destDir, newDirPermissions)
if err != nil {
panic(err)
runProcess("go", "build", "-o", getGaugeExecutablePath(inProgress))
}

func getGaugeExecutablePath(file string) string {
return filepath.Join(getBinDir(), getExecutableName(file))
}

func getExecutableName(file string) string {
if getGOOS() == "windows" {
return file + ".exe"
}
runProcess("go", ".", "build", "-o", destDir)
return file
}

// key will be the source file and value will be the target
Expand Down

0 comments on commit f201d57

Please sign in to comment.