[Golang Installation Problems]Installed golang still go: command not found

gkzz
2 min readSep 9, 2019

--

Command ‘go’ not found

I’ve learned golang with this udemy’s course, as I need to know some concepts of it:

The following error occurred to me:

gkz@localhost ~$ go build
Command ‘go’ not found, but can be installed with:
sudo snap install go # version 1.12.9, or
sudo apt install golang-go # version 2:1.10~4ubuntu1
sudo apt install gccgo-go # version 2:1.10~4ubuntu1
See ‘snap info go’ for additional versions.

What’s going on?????

Although, as seeing the official golang’s tutorial, I’ve already installed go by executing as bellow, I can’t build it:

tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz

Two probable causes:

  • The installation is not done.
  • Setup Go in the PATH environment variable is unfinished.

1. The installation is not done?

gkz@localhost ~$ ll /usr/local/go/bin/
total 34740
drwxr-xr-x 2 root root 4096 Aug 16 03:51 ./
drwxr-xr-x 10 root root 4096 Aug 16 03:48 ../
-rwxr-xr-x 1 root root 14613596 Aug 16 03:50 go*
-rwxr-xr-x 1 root root 17422189 Aug 16 03:51 godoc*
-rwxr-xr-x 1 root root 3525802 Aug 16 03:50 gofmt*
gkz@XPS13-9380 ~/workspace/go-tutorial

2. Setup Go in the PATH environment variable is unfinished.

gkz@localhost ~$ go versionCommand 'go' not found, but can be installed with:sudo snap install go         # version 1.12.9, or
sudo apt install golang-go # version 2:1.10~4ubuntu1
sudo apt install gccgo-go # version 2:1.10~4ubuntu1
See 'snap info go' for additional versions.

I tried to add GOPATH in ~/.profile, as making a use of the official document as reference:

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

src:

My problem was solved!!

gkz@localhost ~$ go version
go version go1.12.9 linux/amd64
gkz@localhost ~$ which go
/usr/local/go/bin/go

I’d be happy if this article helps you to have a fun to learn golang, and much happier if you share it and follow my twitter acct :)

--

--

gkzz

🇯🇵 #SoftwareDeveloper #MeijiUniv @apc_tweet Opinions are my own. #Geek #ギークハウス大倉山 #gkz https://gkzz.github.io/