go command not found

In this troubleshooting guide we learn how to fix go command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

go: command not found

or when using sudo you get the following error message

sudo: go: command not found

Solutions to go: command not found

How To Fix go: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu go is provided by gccgo-go package.

gccgo-go is:

The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

Installing this package will install the gccgo implementation as /usr/bin/go. It conflicts with golang-go.

To fix this problem, we can install more using the command below.

sudo apt-get -y install gccgo-go

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install gccgo-go.

sudo apt -y install gccgo-go

Or if you have aptitude installed you can use the following command.

sudo aptitude install gccgo-go

Summary

In this tutorial we learn how to fix go command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.