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")
}
}
}