A lightweight, cross-platform Go library for opening URLs in the system's default browser.
- Extensive platform support
- Non-blocking operation
- Zero dependencies
- Simple, clean API
- Thoroughly tested
go get github.com/jasonlovesdoggo/gopen
go install github.com/jasonlovesdoggo/gopen/cmd/gopen@latest
package main
import (
"fmt"
"github.com/jasonlovesdoggo/gopen"
)
func main() {
err := gopen.Open("https://github.com")
if err != nil {
fmt.Printf("Failed to open URL: %v\n", err)
}
}
gopen https://jasoncameron.dev
- Supported architectures: 386, amd64, arm, arm64
- Uses
cmd /c start
command
- Supported architectures: amd64, arm64
- Uses
open
command
- Supported architectures: amd64, arm64
- Uses
uiopen
command
- Supported architectures: 386, amd64, arm, arm64
- Uses Android intent system
Supports the following operating systems and architectures:
- Linux (386, amd64, arm, arm64, ppc64, ppc64le, mips, mips64, mips64le, mipsle, riscv64, s390x)
- FreeBSD (386, amd64, arm, arm64)
- OpenBSD (386, amd64, arm, arm64)
- NetBSD (386, amd64, arm, arm64)
- DragonFly BSD (amd64)
- Solaris (amd64)
- illumos (amd64)
- AIX (ppc64)
For Unix-like systems, the following browsers are tried in order:
wslview
(Windows Subsystem for Linux)xdg-open
(Generic X11)sensible-browser
(Debian/Ubuntu)firefox
(Mozilla Firefox)google-chrome
(Google Chrome)chromium
(Chromium)chromium-browser
(Chromium alternative)safari
(Safari)opera
(Opera)epiphany
(GNOME Web)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
This project was inspired by the Rust open-rs crate and this stack overflow post