Skip to content

cmd/go: doc -http should start a pkgsite instance and open a browser #68106

Closed
@adonovan

Description

@adonovan

The go doc command displays documentation to stdout, which is handy for quick forays for a single package or symbol, but for extended reading a browser is more convenient, as it has better typography and linked cross-references. We propose that go doc -http should start a pkgsite instance in the background (if one is not running already) and open a web browser to the correct URL for the package or symbol.

The pkgsite program is currently rather large and slow to start as it was designed as a long-lived server for a large corpus on Google Cloud. Issue #61399 tracks the work to slim it down and reduce dependencies.

Open questions:

  • How should successive go doc processes communicate the port or pid of the running instance, and deal with server crashes?
  • The server would necessarily outlive the go command. Is an explicit "stop" operation necessary?
  • Should the -http flag be a boolean, or an integer port? I think boolean (picking any unused port) would be more friendly.

@rsc @matloob

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Accepted

Relationships

None yet

Development

No branches or pull requests

Issue actions