Skip to content

Commit

Permalink
zshrc: godoc workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Aug 14, 2019
1 parent c551a38 commit 812710c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,23 @@ sdcard() {
sudo dd of=/dev/disk/by-id/usb-Generic-_USB3.0_CRW_-SD_201006010301-0:0 bs=64k oflag=dsync status=progress if="$1"
}

function godoc() {
if [ ! -f "$(pwd)/go.mod" ]
then
echo "error: go.mod not found" >&2
return
fi

module=$(sed -n 's/^module \(.*\)/\1/p' go.mod)
docker run \
--rm \
-e "GOPATH=/tmp/go" \
-p 127.0.0.1:7070:6060 \
-v $(pwd):/tmp/go/src/$module \
golang \
bash -c "echo http://localhost:6060/pkg/$module && godoc -http=:6060"
}

# Edit a temporary file with my template for a C proof-of-concept
alias cpoc='cd /tmp && FN=$(mktemp --suffix=.c) && cp ~/configfiles/poc-template.c $FN && vi $FN && echo "Proof-of-concept stored in $FN"'

Expand Down

0 comments on commit 812710c

Please sign in to comment.