func restartProc() {
	log.Print("Killing Process:  ", pid)
	if proc, err := os.FindProcess(pid); err != nil {
		log.Print("error: ", err)
		startProc()
	} else {
		err := proc.Kill()
		if err != nil {
			log.Print("error: ", err)
		}
		_, err = proc.Wait()
		if err != nil {
			log.Print("error: ", err)
		}
		startProc()
	}
}
Restart the process with pid value in the global variable pid
If it cannot find the process to kill assume the process is
already dead and start a new instance
package main
import (
	"flag"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"strings"
	"time"
)
var (
	path      string                 
	command   string                 
	ext       string                 
	pid       int                    
	polling   bool                   
	pollList  map[string]polledFile  
	ignoreDir map[string]bool        
)
func init() {
	flag.StringVar(&path, "watch", ".", "path to be watched")
	flag.StringVar(&command, "command", "echo", "process to be run")
	flag.StringVar(&ext, "ext", "go", "extension to be watched")
	flag.BoolVar(&polling, "polling", false, "use polling")
	flag.BoolVar(&polling, "p", false, "use polling")
	flag.Parse()
	ignoreDir := make(map[string]bool, 256)
	ignoreDir[".git"] = true
}
type polledFile struct {
	path    string
	modTime time.Time
}
func startProc() {
	log.Print("Starting Process...")
	commandArray := strings.Split(command, " ")
	paramArray := commandArray[1:]
	cmd := exec.Command(commandArray[0], paramArray...)
	err := cmd.Start()
	if err != nil {
		log.Fatal(err)
	}
	log.Print("Process Started Successfuly: ", cmd.Process.Pid)
	pid = cmd.Process.Pid
}