package browser import ( "os/exec" "runtime" ) // Open opens the specified URL in the default browser func Open(url string) error { var cmd string var args []string switch runtime.GOOS { case "windows": cmd = "rundll32" args = []string{"url.dll,FileProtocolHandler", url} case "darwin": cmd = "open" args = []string{url} default: // linux and others cmd = "xdg-open" args = []string{url} } return exec.Command(cmd, args...).Start() }