Skip to content

Instantly share code, notes, and snippets.

@andradei
Last active March 11, 2016 05:02
Show Gist options
  • Save andradei/925d95d1e8fe4978d619 to your computer and use it in GitHub Desktop.
Save andradei/925d95d1e8fe4978d619 to your computer and use it in GitHub Desktop.
Bash function to use Go's tooling
# Implement `oracle implements` with help to find byte offsets to use
# Usage: go-impl [path-to-file].go [identifier type]
# Example: go-impl somepackage/file.go MyType
if [[ -n $1 && -n $2 ]]; then
if [[ -a $1 ]]; then
cat $1 | grep -b $2
echo "Choose a byte offset from the list above"
local byte_offset
read byte_offset
oracle -pos $1:"#"$byte_offset implements
else
echo $1 "isn't a file"
fi
else
echo "Usage:"
echo "go-impl <.go filepath> <search expression>"
fi
# Start godoc server in the background
godoc -http=:6060 -index &
echo Go Docs serving as :6060, running in the background.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment