Friday, November 22, 2024
Google search engine
HomeGuest BlogsHow To Install Go (Golang) On Fedora 38/37/36/35/34

How To Install Go (Golang) On Fedora 38/37/36/35/34

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

This guide will walk you through the installation of Go (Golang) on Fedora 38/37/3635/34/33. Go is a programming language designed to ease the Development of reliable, simple, and efficient applications. It is an original product of Google Engineering.

install latest golang centos7 ubuntu 18.04 01

In this guide, we will install Go on Fedora 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 using the commands below.

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

sudo dnf -y install go

Confirm the version of Go installed:

$ go version
go version go1.21.0 linux/amd64

Test Go installation on Fedora

Now that we have Go installed on Fedora, let’s test to ensure it is working.

Start by creating your workspace directory.

mkdir $HOME/go

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:

cat>helloworld.go<<EOF
package main
import "fmt"
func main() {
	fmt.Printf("hello, world\n")
}
EOF

Build the application with go tool:

cd $HOME/go/src/helloworld
go mod init
go build

This will generate a new file called helloworld .

$ 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 $PATH.

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

$ source ~/.bashrc 

You have installed Go on Fedora Linux system. Enjoy developing Go applications on your Fedora Workstation.

Go learning courses:

Similar:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments