Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Created February 17, 2016 00:07
Show Gist options
  • Save lcaballero/c6fb3e056f3438725c10 to your computer and use it in GitHub Desktop.
Save lcaballero/c6fb3e056f3438725c10 to your computer and use it in GitHub Desktop.
Launches godoc from inside a package opening the doc for that package.
#!/bin/bash
function godoc_procs() {
ps -ef | grep 'godoc -http=:1212' | grep -v grep | cut -f 2 -d ' '
}
function launch_godoc() {
procs=$(godoc_procs)
if [ "$procs" -gt 1 ]; then
godoc_procs | xargs kill -9
fi
curr=$(go list .)
(godoc -http=:1212 &) && open "http://localhost:1212/pkg/$curr"
}
launch_godoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment