From c52f10f92d35e783c30ca6c6a13d898b1c1a3a7f Mon Sep 17 00:00:00 2001 From: maddalax Date: Fri, 24 Jan 2025 11:39:22 -0600 Subject: [PATCH] Revert "make run server build the binary instead of outputting each run to a tmp file" This reverts commit d9c7fb3936d7fa5d553d88b06a4ee2124fb1835d. --- cli/htmgo/tasks/run/runserver.go | 39 ++------------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/cli/htmgo/tasks/run/runserver.go b/cli/htmgo/tasks/run/runserver.go index bb2289b..a47f7e9 100644 --- a/cli/htmgo/tasks/run/runserver.go +++ b/cli/htmgo/tasks/run/runserver.go @@ -1,42 +1,7 @@ package run -import ( - "fmt" - "github.com/maddalax/htmgo/cli/htmgo/tasks/process" - "io/fs" - "os" - "path/filepath" -) +import "github.com/maddalax/htmgo/cli/htmgo/tasks/process" func Server(flags ...process.RunFlag) error { - buildDir := "./__htmgo/temp-build" - _ = os.RemoveAll(buildDir) - err := os.Mkdir(buildDir, 0755) - - if err != nil { - return err - } - - process.RunOrExit(process.NewRawCommand("", fmt.Sprintf("go build -o %s", buildDir))) - - binaryPath := "" - - // find the binary that was built - err = filepath.WalkDir(buildDir, func(path string, d fs.DirEntry, err error) error { - if d.IsDir() { - return nil - } - binaryPath = path - return nil - }) - - if err != nil { - return err - } - - if binaryPath == "" { - return fmt.Errorf("could not find the binary") - } - - return process.Run(process.NewRawCommand("run-server", fmt.Sprintf("./%s", binaryPath), flags...)) + return process.Run(process.NewRawCommand("run-server", "go run .", flags...)) }