-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathinstallGolang.sh
executable file
·53 lines (42 loc) · 1.47 KB
/
installGolang.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
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
helpme()
{
cat <<HELPMEHELPME
Syntax: sudo $0
Installs the stuff needed to get the VirtualBox Ubuntu (or other similar Linux
host) into good shape to run our development environment.
This script needs to run as root.
The current directory must be the dev-env project directory.
HELPMEHELPME
}
if [[ "$1" == "-?" || "$1" == "-h" || "$1" == "--help" ]] ; then
helpme
exit 1
fi
set -e
set -x
# Setup the GOPATH; even though the shared folder spec gives the consul
# directory the right user/group, we need to set it properly on the
# parent path to allow subsequent "go get" commands to work. We can't do
# normal -R here because VMWare complains if we try to update the shared
# folder permissions, so we just update the folders that matter.
sudo mkdir -p $GOPATH
sudo mkdir -p $GOPATH/pkg
sudo mkdir -p $GOPATH/bin
sudo chown -R vagrant:vagrant $GOPATH
#find /opt/gopath -type d -maxdepth 3 | xargs sudo chown vagrant:vagrant
cat <<EOF >/tmp/gopath.sh
export GOPATH="$GOPATH"
export GOROOT="$GOROOT"
export PATH="$GOROOT/bin:$GOPATH/bin:\$PATH"
export CGO_CFLAGS="-I/opt/rocksdb/include"
export CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy"
EOF
sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh
sudo chmod 0755 /etc/profile.d/gopath.sh
source /etc/profile.d/gopath.sh
# Install Go Vendor for vendor support
go get github.com/kardianos/govendor
# Install Golint and goimports
go get github.com/golang/lint/golint
go get golang.org/x/tools/cmd/goimports