forked from mongodb/mongo-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
set_gopath.sh
executable file
·42 lines (37 loc) · 1.36 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
36
37
38
39
40
41
42
#!/bin/bash
TOOLS_PKG='github.com/mongodb/mongo-tools'
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 for the mongo tools
rm -rf .gopath/
mkdir -p .gopath/src/"$(dirname "${TOOLS_PKG}")"
ln -sf `pwd` .gopath/src/$TOOLS_PKG
export GOPATH=`pwd`/.gopath:`pwd`/vendor
else
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/"$TOOLS_PKG"
cp -r `pwd`/bsondump .gopath/src/$TOOLS_PKG
cp -r `pwd`/common .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongodump .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongoexport .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongofiles .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongoimport .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongooplog .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongorestore .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongostat .gopath/src/$TOOLS_PKG
cp -r `pwd`/mongotop .gopath/src/$TOOLS_PKG
cp -r `pwd`/vendor/src/github.com/* .gopath/src/github.com
cp -r `pwd`/vendor/src/gopkg.in .gopath/src/
export GOPATH="$SOURCE_GOPATH;$VENDOR_GOPATH"
fi;
}
setgopath