From fab38eb51a81e90980b4a61c0496baa498fe3596 Mon Sep 17 00:00:00 2001 From: Adam Veldhousen Date: Wed, 18 May 2016 10:39:55 -0500 Subject: [PATCH] added gocd, which will cd you into a go project from anywhere --- .bash_functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.bash_functions b/.bash_functions index 6db2911..9353bbe 100644 --- a/.bash_functions +++ b/.bash_functions @@ -72,6 +72,15 @@ function dumptcp(){ sudo tcpdump -s 0 -A -i $DUMPINTERFACE "tcp port $DUMPPORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" } +function gocd(){ + if [ -z "$1" ]; then + cd $GOPATH; + return 0; + fi + + cd $(go list -f '{{ .Dir }}' $1) +} + function interfaces(){ ifconfig | grep "\: flags" | awk '{print $1}' | sed 's/:$//'; }