This guide will walk you through the installation of Go (Golang) on Fedora 35/34/33/32. Go is a programming language designed to ease the Development of reliable, simple, and efficient applications. It is an original product of Google Engineering.
In this guide, we will install Go on Fedora 35/34/33/32 from official upstream repositories. To ensure the repositories are up-to-date, update the system.
sudo dnf -y update
Once you confirm it is up, install Go on Fedora 35/34/33/32 using the commands below.
sudo dnf -y install go
Confirm the version of Go installed:
$ go version go version go1.16.8 linux/amd64
Test Go installation on Fedora 35/34/33/32
Now that we have Go installed on Fedora, let’s test to ensure it is working.
Start by creating your workspace directory.
Create a directory inside it to host a test Go application.
cd $HOME/go mkdir -p src/helloworld && cd src/helloworld
Create a file named
helloworld.go that looks like:
Build the application with
cd $HOME/go/src/helloworld go mod init go build
This will generate a new file called
$ ls helloworld helloworld.go
Execute the file by running.
$ ./helloworld hello, world
To install the binary into your workspace’s bin directory, use:
$ go install $ ls ~/go/bin/ helloworld
To remove it use:
go clean -i
You can add your Go binary directory to
$ vim ~/.bashrc export PATH="$PATH:~/go/bin/" export GOPATH="~/go" $ source ~/.bashrc
You have installed Go on Fedora 35/34/33/32. Enjoy developing Go applications on your Fedora Workstation.