browser

A minimal Go library for opening files, readers, and URLs in the user's default browser.

Library
Go
vv0.0.0-20240102092130-5ac0b6a4141c
620stars
BSD-2-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
36/100Needs Attention
Development Activity0
Maintenance0
Community64
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
51/100Fair
Architecture75
Code Quality45
Innovation30
Learning Curve55

pkg/browser is a small Go package that opens files, io.Reader contents, or URLs in the user’s default web browser. It exposes three functions — OpenFile, OpenReader, and OpenURL — that hide the platform-specific mechanics of invoking a browser, whether that’s macOS’s open, Windows’ ShellExecute syscall, or Linux’s xdg-open/x-www-browser/www-browser fallback chain.

Rather than shipping opinions about which browser to launch, it defers entirely to the client machine’s default handler, making it a thin, dependable primitive for Go CLIs and tools that need to hand off to a browser — for example opening a generated HTML report, a local dev server, or an OAuth login page.

What You Get

  • OpenURL - opens a new browser window pointed at any URL using the OS’s native handler.
  • OpenFile - resolves a local file path to an absolute file:// URL and opens it in the browser.
  • OpenReader - writes the contents of any io.Reader to a temporary HTML file and opens it, useful for rendering generated content on the fly without managing a temp file yourself.
  • Cross-platform dispatch - platform-specific build files (browser_darwin.go, browser_linux.go, browser_windows.go, browser_freebsd.go, browser_netbsd.go, browser_openbsd.go, browser_unsupported.go) select the right open mechanism at compile time via Go build tags.

Common Use Cases

  • CLI tools that open a login page - a command-line OAuth flow that needs to hand the user off to a browser for authentication.
  • Local dev servers - a Go program that starts a local web server and immediately opens it in the browser for the developer.
  • Rendering generated reports - a build or test tool that produces an HTML report and opens it directly via OpenReader without writing to a permanent file.
  • Documentation generators - godoc-style tools that open freshly generated docs in the browser.

Under The Hood

Architecture The package is a single flat browser package built around three exported entry points in browser.go — OpenURL, OpenFile, and OpenReader — all funneling into an unexported openBrowser(url string) error. That function has no single implementation; instead, seven OS-specific files (browser_darwin.go, browser_linux.go, browser_windows.go, browser_freebsd.go, browser_netbsd.go, browser_openbsd.go, and a browser_unsupported.go catch-all guarded by a !linux,!windows,!darwin,!openbsd,!freebsd,!netbsd build constraint) each supply their own openBrowser, and the Go compiler picks exactly one at build time. This is a clean, idiomatic use of Go’s build-tag mechanism to express a strategy pattern without runtime branching or an interface — swapping or extending platform support means adding one small file, and nothing else in the package would need to change.

Tech Stack The module targets Go 1.14 and declares a single external dependency, golang.org/x/sys v0.1.0, used only by the Windows build to call windows.ShellExecute. There is no build tooling beyond go build/go test; CI is one GitHub Actions workflow (push.yml) that runs go test -v ./... on Go 1.15 against ubuntu-latest only, meaning the darwin and windows code paths are never exercised in CI. The package has no runtime dependencies beyond the Go standard library on non-Windows platforms.

Code Quality Testing consists solely of example_test.go, which defines three Example* functions (ExampleOpenFile, ExampleOpenReader, ExampleOpenURL) that call each public function but include no // Output: comment, so go test runs them without asserting anything — there is effectively no verified test coverage, including no coverage of the Linux fallback chain or the unsupported-OS error path. Error handling is idiomatic Go: every public function returns an error, and OpenReader wraps failures with fmt.Errorf and descriptive context. Naming is minimal and consistent (openBrowser, runCmd). No linter configuration or CI lint step is present.

What Makes It Unique The package is not novel — it’s a straightforward wrapper around OS-native “open a URL” invocations, comparable to Python’s webbrowser module or Node’s open package. Its two distinguishing touches are the ordered fallback chain of three Linux openers (xdg-open, x-www-browser, www-browser) and the OpenReader convenience, which removes the boilerplate of writing a reader’s contents to a temp file before opening it.

Used by 9 apps in this directory

Go
85%
Apache 2.0

Argo Workflows

Devops · Data Engineering

16,943

The most popular Kubernetes-native workflow engine for orchestrating containerized DAGs, ML pipelines, CI/CD, and parallel batch jobs at scale.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
Go85%
TypeScript11%
Updated yesterday
Go
75%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,299

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
93
Repo Health
90
Technical
69
Dependency
Built with
Go75%
TypeScript23%
Updated today
Go
98%
Other

Crush

Developer Tools · AI Code Assistants · AI Assistants

27,798

Your terminal coding companion — wire up any LLM with LSP intelligence, MCP extensibility, and a skills system that learns your workflow.

View details
87
Repo Health
86
Technical
69
Dependency
Built with
Go98%
Updated today
Go
97%
Apache 2.0

infracost

Devops · Developer Tools

12,499

Infracost shows cloud cost estimates for Terraform, CloudFormation, and AWS CDK before you deploy — in your terminal, editor, AI coding agent, and pull requests.

View details
79
Repo Health
78
Technical
68
Dependency
Built with
Go97%
Updated 6 days ago
Go
60%
MIT

Obot

AI Agents

965

An open-source MCP platform for organizations — host MCP servers, run MCP registries, monitor usage, and build agents and chatbots on top of the Model Context Protocol from one self-hosted deployment.

View details
87
Repo Health
70
Technical
70
Dependency
Built with
Go60%
Svelte29%
Updated yesterday
Go
71%
MIT

Ollama

AI Development · Developer Tools

179,765

Run Llama, Gemma, DeepSeek, and other open LLMs on your own machine with one command and an OpenAI-compatible API.

View details
89
Repo Health
85
Technical
69
Dependency
Built with
Go71%
C21%
Updated yesterday
Go
93%
MIT

Plandex

AI Code Assistants

15,598

An open-source, terminal-based AI coding agent built for large tasks and real codebases — with its own version control for plans, a 2M-token effective context window, and self-hosted or cloud deployment.

View details
49
Repo Health
70
Technical
68
Dependency
Built with
Go93%
Updated 11 months ago
Python
54%
Other

PostHog

Analytics · Monitoring · Developer Tools

39,479

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
66
Dependency
Built with
Python54%
TypeScript36%
Updated today
Go
73%
AGPL 3.0

Vikunja

Project Management

5,206

Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.

View details
86
Repo Health
81
Technical
74
Dependency
Built with
Go73%
TypeScript14%
Vue12%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search