I am trying to figure out why some shell commands work with goloang exec.Command and others don't when they all return the same result when entered in terminal. I basically would like to use the same command for windows and mac binary (exec.Command("where", "go").Output()).
These specifically:
goInstalled, err := exec.Command("where", "go").Output() // does not return output on mac when compiled but does in terminal command. DOES return output on windows compiled.
goInstalled, err := exec.Command("which", "go").Output() // does not return output on mac when compiled but does in terminal command
goInstalled, err := exec.Command("command", "-v", "go").Output() // returns output when compiled and as terminal command (mac only)
I would like to use the same command for windows and mac (darwin) if possible rather than create two separate functions to check if things are installed on users machine.