| Conditions | 6 |
| Total Lines | 15 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package util |
||
| 10 | func OpenBrowser(url string) { |
||
| 11 | var err error |
||
| 12 | |||
| 13 | switch runtime.GOOS { |
||
| 14 | case "linux": |
||
| 15 | err = exec.Command("xdg-open", url).Start() |
||
| 16 | case "windows": |
||
| 17 | err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() |
||
| 18 | case "darwin": |
||
| 19 | err = exec.Command("open", url).Start() |
||
| 20 | default: |
||
| 21 | err = fmt.Errorf("unsupported platform") |
||
| 22 | } |
||
| 23 | if err != nil { |
||
| 24 | log.Fatal(err) |
||
| 25 | } |
||
| 27 |