package util import ( "log" "os/exec" "strings" ) func RootDir() string { cmdOut, err := exec.Command("git", "rev-parse", "--show-toplevel").Output() if err != nil { log.Fatalf("exec.Command: %s", err) return "" } rootDir := strings.TrimSpace(string(cmdOut)) return rootDir }