19 lines
291 B
Go
19 lines
291 B
Go
|
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
|
||
|
}
|