commit 17e09bfb1c8c707b855aafefd163d2f3498012aa (tree)
parent 91e3de2cc7d6bc126bf28c472c33aaa11bae5221
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Wed, 21 Aug 2019 14:09:27 +0300
gopath
Diffstat:
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/bash/.gg.sh b/bash/.gg.sh
@@ -4,6 +4,8 @@
maxdepth=3
+_gopath=$HOME/.go-code
+
gg() {
paths=($(g "$@"))
path_index=0
@@ -11,7 +13,7 @@ gg() {
if [ ${#paths[@]} -gt 1 ]; then
c=1
for path in "${paths[@]}"; do
- echo [$c]: cd ${GOPATH}/${path}
+ echo [$c]: cd ${_gopath}/${path}
c=$((c+1))
done
echo -n "Go to which path: "
@@ -21,14 +23,14 @@ gg() {
fi
path=${paths[$path_index]}
- cd $GOPATH/src/$path
+ cd $_gopath/src/$path
}
#
# Print the directories of the specified Go package name.
#
g() {
- local pkg_candidates="$((cd $GOPATH/src && find . -mindepth 1 -maxdepth ${maxdepth} -type d \( -path "*/$1" -or -path "*/$1.git" \) -and -not -path '*/vendor/*' -print) | sed 's/^\.\///g')"
+ local pkg_candidates="$((cd $_gopath/src && find . -mindepth 1 -maxdepth ${maxdepth} -type d \( -path "*/$1" -or -path "*/$1.git" \) -and -not -path '*/vendor/*' -print) | sed 's/^\.\///g')"
echo "$pkg_candidates"
}
#
@@ -41,7 +43,7 @@ _g_complete()
local prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
- COMPREPLY=( $(compgen -W "$(for f in $(find "$GOPATH/src" -mindepth 1 -maxdepth ${maxdepth} -type d -name "${cur}*" ! -name '.*' ! -path '*/.git/*' ! -path '*/test/*' ! -path '*/Godeps/*' ! -path '*/examples/*' ! -path '*/vendor/*'); do echo "${f##*/}"; done)" -- "$cur") )
+ COMPREPLY=( $(compgen -W "$(for f in $(find "$_gopath/src" -mindepth 1 -maxdepth ${maxdepth} -type d -name "${cur}*" ! -name '.*' ! -path '*/.git/*' ! -path '*/test/*' ! -path '*/Godeps/*' ! -path '*/examples/*' ! -path '*/vendor/*'); do echo "${f##*/}"; done)" -- "$cur") )
return 0
}
complete -F _g_complete g
diff --git a/bash/.profile_motiejus b/bash/.profile_motiejus
@@ -10,7 +10,8 @@ export VAGRANT_DEFAULT_PROVIDER=virtualbox
eval "$(direnv hook bash)"
export DIRENV_LOG_FORMAT=""
-export PATH=/usr/local/opt/sqlite/bin:$HOME/bin:$HOME/.cargo/bin:$PATH
+export GOPATH=$HOME/.gopath
+export PATH=/usr/local/opt/sqlite/bin:$HOME/bin:$HOME/.cargo/bin:$GOPATH/bin:$PATH
export CLUSTODSN=postgresql://clusto:clusto@127.0.0.1:5432/clusto
#export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/src/
diff --git a/vim/.vim/vimrc b/vim/.vim/vimrc
@@ -44,6 +44,7 @@ au BufRead,BufNewFile *.avsc setlocal ts=2 sw=2 sws=2
au FileType go setlocal noet
au FileType go nnoremap <C-]> :GoDef<CR>
au FileType go let g:go_fmt_command = "goimports"
+"au FileType go let g:go_fmt_command = "gofmt"
au FileType go let g:go_template_autocreate = 0
" rust