Created
February 17, 2016 00:07
-
-
Save lcaballero/c6fb3e056f3438725c10 to your computer and use it in GitHub Desktop.
Launches godoc from inside a package opening the doc for that package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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