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/gopengo install github.com/jasonlovesdoggo/gopen/cmd/gopen@latestpackage 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 startcommand
- Supported architectures: amd64, arm64
- Uses
opencommand
- Supported architectures: amd64, arm64
- Uses
uiopencommand
- 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