Last active
March 11, 2016 05:02
-
-
Save andradei/925d95d1e8fe4978d619 to your computer and use it in GitHub Desktop.
Bash function to use Go's tooling
This file contains 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
# 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 |
This file contains 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
# 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