gohdoc

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2019 License: MIT Imports: 19 Imported by: 0

README

gohdoc

gohdoc opens a package's godoc in the browser.

Go Report Card

Why?

To verify that your package's godoc is formatted correctly in the browser. Or because you prefer to view godoc in the browser.

Overview

In your package dir, execute gohdoc . (or just gohdoc). This will open the current package's godoc in the browser, starting a godoc http server if necessary. You can specify absolute and relative paths, or full or partial package names, e.g. gohdoc fmt or gohdoc encoding/jso. Fragments are preserved, so gohdoc fmt#Println will work. Use gohdoc -search or gohdoc -list to interrogate the set of packages on the godoc server.

Why?

The original purpose was to swiftly verify that the godoc I was writing for my package was properly formatted in godoc's HTML rendering. But then I also found it useful for generically opening godoc in the browser.

Install

gohdoc is installed in the usual Go fashion:


$ go get -u github.com/neilotoole/gohdoc

Usage

Use gohdoc -help to see someing like this:

gohdoc opens a package's godoc in the browser.

gohdoc (go http doc) looks for an existing godoc http server, and uses that if
available. If not, gohdoc will start a godoc http server on port 6060; override
with envar GODOC_HTTP_PORT. The godoc http server will continue to run after
gohdoc exits, but can be killed using gohdoc -killall.


Usage:

  gohdoc                                   open current pkg godoc in browser
  gohdoc .                                 same as above
  gohdoc my/sub/pkg                            
  gohdoc /go/src/github.com/my/pkg      
  gohdoc fmt                                   
  gohdoc fmt#Println                       open fmt#Println godoc
  gohdoc .#MyFunc                          open current pkg #MyFunc godoc
  gohodc '#MyFunc'                         same as above, quoted because bash


Interrogate the godoc server's package list:

  gohdoc -list                             list all packages on the godoc http server
  gohdoc -listv                            same as -list, but also print pkg url
  gohdoc -search pkg/name                  list packages that match arg
  gohdoc -searchv pkg/name                 same as -search, but also print pkg url


List or kill running godoc servers:

  gohdoc -servers                          list godoc http server processes
  gohdoc -killall                          kill all godoc http server processes


For completeness:

  gohdoc -help                             print this help message
  gohdoc -version                          print gohdoc version


The -debug flag can be used to enable debug logging. If gohdoc spawns a godoc
http server, the -debug flag will also print that server's verbose output.

Note that a godoc http server is tied to a particular GOPATH. If your pkg is
unexpectedly not found, verify that the godoc http server is started on the
correct GOPATH. If necessary, use gohdoc -killall and rerun gohdoc inside the
appropriate GOPATH.

Feedback

Bugs, feature requests etc, open an issue. Make sure to run gohdoc with the -debug flag and include the output in the issue.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL