How to install Go programming language on debian 8.6

How to install Go programming language on debian 8.6

Go, is a modern, open-source programming language developed by Google. Increasingly popular for many applications, Go takes a minimalist approach to development and makes it easy to build reliable and efficient software. The installation process is explained as follows.

Installation process

Now you should first download the Go tar file.

root@linuxhelp:~# curl -O https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 80.1M  100 80.1M    0     0  1115k      0  0:01:13  0:01:13 --:--:-- 1140k

Then extract the tar file.

root@linuxhelp:~# tar xvf go1.7.4.linux-amd64.tar.gz
go/
go/AUTHORS
go/CONTRIBUTING.md
go/CONTRIBUTORS
go/LICENSE
go/PATENTS
go/README.md
go/VERSION
go/api/
go/api/README
go/api/except.txt
go/api/go1.1.txt
go/api/go1.2.txt
go/api/go1.3.txt
go/api/go1.4.txt
go/api/go1.5.txt
go/api/go1.6.txt
go/api/go1.7.txt
.
.
.
go/test/uintptrescapes.dir/a.go
go/test/uintptrescapes.dir/main.go
go/test/uintptrescapes.go
go/test/uintptrescapes2.go
go/test/undef.go
go/test/utf.go
go/test/varerr.go
go/test/varinit.go
go/test/writebarrier.go
go/test/zerodivide.go

Now you can move the extracted directory to " /usr/local" directory.

root@linuxhelp:~# mv go /usr/local

Set environment variable path on profile file like below.

root@linuxhelp:~# nano ~/.profile

In profile settings, set the environment variables. Type the lines and save it.

export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Now reload the profile file.

root@linuxhelp:~# source ~/.profile

Create directory for projects.

root@linuxhelp:~# mkdir $HOME/work

Then create project directory.

root@linuxhelp:~# mkdir -p work/src/my_project/hello

Create sample project execution file like below.

root@linuxhelp:~# nano ~/work/src/my_project/hello/hello.go

package main
import " fmt" 
func main() {
    fmt.Printf(" Hello, World!
" )
}

Next compile your project by using go install command.

root@linuxhelp:~# go install my_project/hello

Now run your project.

root@linuxhelp:~# hello
Hello, World!
Tag : Go language
FAQ
Q
what is the next step after downloading the GO package?
A
After downloading the package and then need to extract the file which is compressed
Q
what is the purpose of installing the Go programming language on debian?
A
Go, is a modern, open-source programming language developed by Google. Increasingly popular for many applications, Go takes a minimalist approach to development and makes it easy to build reliable and efficient software
Q
which command to compile the go project?
A
compile your project by using go install command.
# go install my_project/hello
Q
how to download the package for GO in terminal?
A
download the package by below command
# curl -O https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
Q
where to download its stable releases for GO?
A
use the below link to download the latest version
https://storage.googleapis.com/golang/ => do checkout this link