A lightweight mechanism to provide an *instant kickstart* to a Go web server instance upon changing any Go source files under the project directory (and its subdirectories).

startstop_windows.go 386B

1234567891011121314151617181920212223
  1. // +build windows
  2. package main
  3. import (
  4. "os"
  5. "os/exec"
  6. "strconv"
  7. )
  8. func start() *exec.Cmd {
  9. buildGopherJSProject()
  10. cmd := exec.Command("go", "run", appPath+"/"+mainSourceFile)
  11. cmd.Stdout = os.Stdout
  12. cmd.Stderr = os.Stderr
  13. cmd.Start()
  14. return cmd
  15. }
  16. func stop(cmd *exec.Cmd) {
  17. stop := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
  18. stop.Run()
  19. }