Skip to content

Instantly share code, notes, and snippets.

@selfup
Last active September 3, 2018 15:56
Show Gist options
  • Save selfup/72dc6c16621e3f09a50153e863f62924 to your computer and use it in GitHub Desktop.
Save selfup/72dc6c16621e3f09a50153e863f62924 to your computer and use it in GitHub Desktop.
switch runtime.GOOS {
case "darwin":
exec.Command("open", "http://localhost:8792").Run()
break
case "windows":
exec.Command("cmd.exe", "/C", "start "+"http://localhost:8792").Run()
break
default:
cmd := exec.Command("xdg-open", "http://localhost:8792")
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
cmd.Run()
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment