Recently somebody have some questions for me.

  • Why i can’t run go get ?
  • How to change workspace project with Go ?
  • Why after i exit session on terminal then all config is reset and go command not found ?

Ok, the following below i will detail, how i installed Go ? You can get more information about it at page https://golang.org/doc/install. 

Step 2: Check Go is installed on system and clear it. sudo rm -rf /usr/local/go

Step 3 : Extract compress file to folder “/usr/local” sudo tar -C /usr/local -xzf go1.9.1.linux-amd64.tar.gz

Step 4 : Setup environment for user (the step is very important) [Centos] Add the configuration to file “~/.bashrc” [Ubuntu] Add the configuration to file “~/.profile”

export GOPATH=/usr/local/go/workspace export GOROOT=/usr/local/go export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Apply all config environment with command

[Centos] source ~/.bashrc

[Ubuntu] source ~/.profile

******* Note ******* GOPATH : this is the directory where you want to save projects. GOROOT : the directory of root Go (Step 3) *******************

Step 5 : Verify installation Check current version Go go version

Selection_022

Show all information configuration of Go go env Selection_019

Done ! If you have a question for me please inbox facebook, linkedIn, we can discuss about it. Good luck!

Advertisements