Skip to content

Release Notes v0.13.0

Released: 2026-11-01

Highlights

Open a URL or a file in the user's default application on every platform in one call. process.OpenDefault picks the platform's opener, so callers need no runtime.GOOS switch, typically to open a local dashboard in the browser.

New Features

process.OpenDefault

if err := process.OpenDefault("http://localhost:9401"); err != nil { // the default browser
    return err
}
if err := process.OpenDefault("/tmp/report.html"); err != nil { // the program registered for .html
    return err
}

The opener for each platform:

Platform Command
macOS open <target>
Linux and the BSDs xdg-open <target>
Windows rundll32 url.dll,FileProtocolHandler <target>

On Windows the URL protocol handler avoids cmd.exe, so characters such as & in a URL are not read as shell syntax. On every platform the target is passed as one argument, unchanged.

OpenDefault returns once the opener has started. It does not wait for the application, and the opener's exit status is not reported.

It refuses an empty or blank target, and one starting with - that the opener could read as an option. Name a file that starts with - as ./-name.

Documentation

  • The process guide explains OpenDefault.
  • The README process example shows it, and the roadmap lists it.

Installation

go get github.com/grokify/oscompat@v0.13.0

Compatibility

Additive only. An API comparison against v0.12.0 reports one compatible change, the new function, and no incompatible changes. The module still has no dependencies outside the standard library.