How to install Go (Golang) on ​​Fedora 31/30/29

This guide will guide you through the installation of Go (Golang) on ​​Fedora 31/30/29. Go is a programming language designed to simplify the development of reliable, simple, and efficient applications. It is the original product of Google Engineering.

In this guide, we will install Go 1.12 on Fedora 31/30/29 from the official upstream repository. To ensure that the repository is up-to-date, update your system.

sudo dnf -y update

After confirming that it has started, use the following command to install Go on Fedora 30.

sudo dnf -y install go

Test Go installation on Fedora 31/30/29

Now that we have Go installed on Fedora 30, let’s test it to make sure it works.

Create your workspace directory first.

mkdir $HOME/go

Create a directory in it to host the test Go application.

cd $HOME/go
mkdir -p src/helloworld && cd src/helloworld

Create a file called helloworld.go looks like:

package main
import "fmt"
func main() {
	fmt.Printf("hello, worldn")
}

Build the application in the following way go tool

cd $HOME/go/src/helloworldgo build

This will generate a file called helloworld .

$ lshelloworld  helloworld.go

Execute the file by running.

$ ./helloworld hello, world

To install the binaries into the bin directory of your workspace, use:

$ go install
$ ls ~/go/bin/
helloworld

To delete it, use:

go clean -i

You can add the Go binary directory to $PATH.

$ vim ~/.bashrc 
export PATH="$PATH:~/go/bin/"
export GOPATH="~/go"

You have Go installed on Fedora 31/30/29. Enjoy developing Go applications on Fedora workstations.

similar:

Install and configure DBeaver on Fedora

How to install Podman on Fedora

How to install Polybar status bar on Fedora

How to install Kodi Media Server on Fedora

Sidebar