Skip to content

Instantly share code, notes, and snippets.

@graphaelli
Created January 4, 2018 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphaelli/43dac2c8a6534b317feb7ceb74ef756f to your computer and use it in GitHub Desktop.
Save graphaelli/43dac2c8a6534b317feb7ceb74ef756f to your computer and use it in GitHub Desktop.
go utils
#!/bin/bash -e
if [ ! -d ${GOPATH} ]; then
echo missing GOPATH
exit 1
fi
mv ${GOPATH} ${GOPATH}.$(date '+%Y%m%d_%H%M%S')
mkdir -p ${GOPATH}
go get -u -v \
github.com/golang/dep/cmd/dep \
github.com/kardianos/govendor \
github.com/nsf/gocode \
golang.org/x/review/git-codereview \
golang.org/x/tools/...
#!/bin/bash
go test -covermode=count -coverprofile=/tmp/$$_count.out $@
go tool cover -html=/tmp/$$_count.out
#!/bin/bash
TARGET=${1:-"./..."}
gotest() {
clear
go test $TARGET
echo $?
}
gotest
export -f gotest
export TARGET
fswatch -o *go | xargs -t -I{} bash -c gotest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment