1 //go:build darwin 2 3 package os 4 5 // via runtime because we need argc/argv ptrs 6 func runtime_executable_path() string 7 8 func Executable() (string, error) { 9 p := runtime_executable_path() 10 if p != "" && p[0] == '/' { 11 // absolute path 12 return p, nil 13 } 14 cwd, err := Getwd() 15 if err != nil { 16 return "", err 17 } 18 return joinPath(cwd, p), nil 19 } 20