Files
core/internal/testhelper/testhelper.go
2022-06-24 19:47:12 +02:00

22 lines
385 B
Go

package testhelper
import (
"fmt"
"os/exec"
"path/filepath"
)
func BuildBinary(name, pathprefix string) (string, error) {
dir := filepath.Join(pathprefix, name)
aout := filepath.Join(dir, name)
fmt.Printf("aout: %s\n", aout)
err := exec.Command("go", "build", "-o", aout, dir).Run()
if err != nil {
return "", fmt.Errorf("build command: %w", err)
}
return aout, nil
}