-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_gopath.sh
executable file
·35 lines (30 loc) · 1.12 KB
/
set_gopath.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
MPLAY_PACKAGE='github.com/mpobrien/pewpewpew'
setgopath() {
if [ "Windows_NT" != "$OS" ]; then
SOURCE_GOPATH=`pwd`.gopath
VENDOR_GOPATH=`pwd`/vendor
# set up the $GOPATH to use the vendored dependencies as
# well as the source
rm -rf .gopath/
mkdir -p .gopath/src/"$(dirname "${MPLAY_PACKAGE}")"
ln -sf `pwd` .gopath/src/$MPLAY_PACKAGE
export GOPATH=`pwd`/vendor:`pwd`/.gopath
else
echo "using windows + cygwin gopath [COPY ONLY]"
local SOURCE_GOPATH=`pwd`/.gopath
local VENDOR_GOPATH=`pwd`/vendor
SOURCE_GOPATH=$(cygpath -w $SOURCE_GOPATH);
VENDOR_GOPATH=$(cygpath -w $VENDOR_GOPATH);
# set up the $GOPATH to use the vendored dependencies as
# well as the source for the mongo tools
rm -rf .gopath/
mkdir -p .gopath/src/"$MPLAY_PACKAGE"
cp -r `pwd`/* .gopath/src/$MPLAY_PACKAGE
# now handle vendoring
rm -rf .gopath/src/$MPLAY_PACKAGE/vendor
cp -r `pwd`/vendor/src/* .gopath/src/.
export GOPATH="$SOURCE_GOPATH;$VENDOR_GOPATH"
fi;
}
setgopath