If you are intending to use google go frequently, then it is better to set the environment variables once and for all, because if you followed google go tutorial which is avaliable at: http://golang.org/doc/install.html, once you close your terminal, you have to reset all the environment variables again as they are gone.
Here is how you can do that just type this in your terminal: sudo gedit ~/.bashrc, this command allow editing in the bashrc file. Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.
So at the end of bashrc type these commands and save the file:
#GLOBAL ENV_VAR
export GOROOT=$HOME/go
export GOARCH=386
export GOOS=linux
export GOBIN=$HOME/go/bin
export PATH=$PATH:$GOBIN
export PATH=$PATH:$HOME/go/src/cmd/8g
After that restart your computer to allow changes to take place. In order to make sure that the environment variable are really set, type this in your terminal after the restart: env | grep '^GO'. If it works you will see the environment variables list as that:
GOBIN=/home/dinahelmy/go/bin
GOARCH=386
GOROOT=/home/dinahelmy/go
GOOS=linux
Monday, May 3, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment