Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Go in Ubuntu 20.04 - DesignLinux

Nov 30 2020
designlinux 0 Comments

Go is a popular programming language created by Google. The first release was on November 10, 2009, and version 1.0 was released in 2012. It is a pretty new language compared to languages like Java, Python, C, C++, etc.. which has been in the market for more than 15 plus years.

Go was Implemented with Assembly language (GC); C++ (gccgo) and Go. In many places, you may see people refer to go as golang and that is because of its domain name, golang.org, but the proper name is Go. Go is cross-platform, it can be installed on Linux, Windows, and macOS.

Features of Go Programming

Following are some of the core features of Go.

  • Statically type and compiled programming language.
  • Concurrency support and Garbage collection.
  • Strong library and toolset.
  • Multiprocessing and High-performance networking.
  • Known for readability and usability (Like Python).

In this article, you will learn how to install and set up Go Programming Language in Ubuntu 20.04.

Installing Go Language in Ubuntu

We will be installing the latest version of Go which is 1.15.5. To download the latest version, go to the official download page and grab the tarball or use the following wget command to download it on the terminal.

$ sudo wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz

Next, extract the tarball to /usr/local directory.

$ sudo tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz

Add the go binary path to .bashrc file /etc/profile (for a system-wide installation).

export PATH=$PATH:/usr/local/go/bin

After adding the PATH environment variable, you need to apply changes immediately by running the following command.

$ source ~/.bashrc

Now verify the installation by simply running the go version in the terminal.

$ go version

You can also install go from the snap store too.

$ sudo snap install --classic --channel=1.15/stable go 

Let’s run our traditional hello world program. Save the file with .go extension.

$ cat > hello-world.go

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

To run the program type go run <file-name> from the terminal.

$ go run hello-world.go
Run Go Programe in Linux
Run Go Program in Linux

Remove Go Language in Ubuntu

To remove Go from the system remove the directory where the go tarball is extracted. In this case, go is extracted to /usr/local/go. Also, remove the entry from ~/.bashrc or ~/.bash_profile depending upon where you added the export path.

$ sudo rm -rf /usr/local/go
$ sudo nano ~/.bashrc        # remove the entry from $PATH
$ source ~/.bashrc

That’s it for this article. Now you have, Go up and running to play with it.

Related

Tags: Go Programming, Ubuntu Tips

How to Install and Use Flatpak on Linux

Prev Post

Basename Command in Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 259
  • 614,631

DesignLinux.com © All rights reserved

Go to mobile version