How to Install GoLang on Fedora 35 / Fedora 34 | Holhol24

18

GoLang is an open-source programming language advanced at Google by way of its engineers in 2009. Go language is very similar to C, however with rubbish assortment, reminiscence protection, and structural typing. It is most generally used for microservices this present day.

Here, we can see set up GoLang on Fedora 35 / Fedora 34.

Install GoLang On Fedora 35

Before putting in the Go Lang, replace your machine with the most recent safety patches to verify the machine isn’t susceptible.

sudo dnf replace -y

Then, reboot your machine

And then, set up the GoLang package deal with the dnf command.

sudo dnf set up -y move

Verify GoLang Installation

After the package deal set up, run the under command to peer the model of the Go language.

move model

Output:

move model go1.16.12 linux/amd64

You too can take a look at the GoLang surroundings variables with the under command.

move env

Output:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fedora/.cache/go-build"
GOENV="/home/fedora/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/fedora/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/fedora/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.12"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2226385121=/tmp/go-build -gno-record-gcc-switches"

Create First GoLang Project

Assuming that you’ve got a workspace known as move on your $HOME listing. Otherwise, create a listing and move to the listing.

mkdir $HOME/move && cd $HOME/move

Let’s create a easy program to check the GoLang set up. To do this, create a venture listing known as hi beneath your workspace.

mkdir -p hi && cd hi

Then, create a document.

vi hi.move

Use the under content material for the hi.move document.

package deal major

import "fmt"

func major() {
    fmt.Printf("Welcome To Holhol24n")
}

Now, bring together it with the move command.

move run hi.move

You will have to get the next greeting textual content.

Welcome To Holhol24

Conclusion

That’s all. You have effectively put in GoLang on Fedora 35 / Fedora 34.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More