Add command to run octant from the build directory
* Updates newCmd to exit if command is not found
* Adds a run-dev command
Since build supports multiple commands, you can `go run build.go build run-dev`
@@ -64,6 +64,8 @@ func main() {
test()
case "build":
build()
+ case "run-dev":
+ runDev()
case "go-install":
goInstall()
case "serve":
@@ -93,7 +95,12 @@ func runCmd(command string, env map[string]string, args ...string) {
}
func newCmd(command string, env map[string]string, args ...string) *exec.Cmd {
- cmd := exec.Command(command, args...)
+ realCommand, err := exec.LookPath(command)
+ if err != nil {
+ log.Fatalf("unable to find command '%s'", command)
+ }
+
+ cmd := exec.Command(realCommand, args...)
cmd.Env = os.Environ()
// Setting Stdout here complains about it already being set?
// cmd.Stdout = os.Stdout
@@ -135,6 +142,10 @@ func build() {
runCmd("go", nil, "build", "-o", "build/octant", GO_FLAGS, "-v", "./cmd/octant")
}
+func runDev() {
+ runCmd("build/octant", nil, "--enable-feature-applications=true")
+}
+
func test() {
runCmd("go", nil, "test", "-v", "./internal/...", "./pkg/...")
}
