Then you need to know if your mac have zsh or bash configured as shell. In this example we gonna use $HOME/dev/go-workspace. You will need to inform to Go the location of your workspace. (or you would need to do a sudo -E bash -c 'go get /gocql/gocql', but I suspect you don't need root here)Īny variables added to these locations will not be reflected when invoking them with a sudo command, as sudo has a default policy of resetting the Environment and setting a secure path (this behavior is defined in /etc/sudoers)
![macbook air doc launchap insalling macbook air doc launchap insalling](https://i.ytimg.com/vi/YyuCc1n7154/maxresdefault.jpg)
Package /gocql/gocql: cannot download, $GOPATH not set. Dineshs-MacBook-Air:go-cassandra Dany$ sudo go get /gocql/gocql
#Macbook air doc launchap insalling install
But when I try to install gocql I am getting error.
#Macbook air doc launchap insalling code
I am able to run go code inside my directory. And I set the GOPATH as my project src directory.
![macbook air doc launchap insalling macbook air doc launchap insalling](https://i.pcmag.com/imagery/reviews/02VGgSMRIjWBm9XCqoj1Wmj-24.fit_scale.size_2698x1517.jpg)
Go is installed in '/usr/local/go/bin/go'. I set the GOROOT and PATH as follows, Dineshs-MacBook-Air:go-cassandra Dany$ which goĭineshs-MacBook-Air:go-cassandra Dany$ export GOROOT=/usr/local/go/bin/goĭineshs-MacBook-Air:go-cassandra Dany$ export PATH=$PATH:$GOROOT/bin