转到-如何检测用户PC是否正在运行某些必备工具(例如Google Chrome)

How can i be 100% sure and check with Go execution of my application that 1, 2 gives me true or false

1) Operating system Windows XP, Vista, 7, 8, 32/64-bit OK if that PC already have Google Chrome browser installed or not?

2) Operating system Mac/Apple, does it has Google Chrome browser Yes or not?

package main
import "os/exec"
import "runtime"
import "fmt"
import "net/http"
const url = "http://localhsot:9090"

func main() {  
  myos := runtime.GOOS // linux, freebsd, netbsd, openbsd, plan9, darwin, windows
  fmt.Println (runtime.GOARCH) // 386, amd64, arm

  if myos == "windows" {
    if myarch == "386" {
      chrome := "C:/Program Files/Google/Chrome/Application/chrome.exe"
    } else {
      chrome := "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
    }          
    cmd := exec.Command(chrome, "--chrome-frame", url)
    err := cmd.Start()
    if err != nil {
      println("Failed to start chrome:", err)
    } 

  } else if myos == "darwin" {
    if myarch == "386" {
      cmd := exec.Command("open", "-b" , "com.google.Chrome", "--args", "--chrome-frame", url)
    } else {
      cmd := exec.Command("open", "-b" , "com.google.Chrome", "--args", "--chrome-frame", url)
    }
    err := cmd.Start()
    if err != nil {
      fmt.Println("failed")
    } 

  } else {
    if myarch == "386" {
      chrome := "google-chrome"
    } else {
      chrome := "google-chrome"
    }   

    cmd := exec.Command(chrome, "--chrome-frame", url)
    err := cmd.Start()
    if err != nil {
      fmt.Println("failed")
    }

  }

}

In Windows,

Win 7 and high:

You can use "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\Google Chrome" to find out install path. This actually coming from "Google Chrome" key found at "HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications".

Win XP to vista:

You could read from "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome". This location i have not verified, please do check if you have xp machine.

For Mac:

You can find chrome install location using chrome's bundle identifier (you could find this from info.plist).