Go is a high-level open-source programming language developed by Google. It is very similar to C and is used to build secure, scalable systems. It is a general-purpose language and is especially useful for distributed systems and cloud services. Go is known for its concurrency and ability to run multiple tasks simultaneously. If you are looking for solving complex computational problems, then Go is the best option for you.

In this post, we will show you how to install and use Golang on Fedora Linux.

Step 1 – Install Golang

By default, the Golang package is included in the Fedora default repo. You can install it using the following command.

dnf -y install go

Once Golang is installed, you can verify the Golang version using the following command.

go version

You will see the following output.

go version go1.16.15 linux/amd64

Step 2 – Create an Application with Golang

First, create an application directory using the following command.

mkdir go

Next, create another directory inside the Go directory.

cd go
mkdir -p src/helloworld 

Next, create a new application named helloworld.go.

cd src/helloworld
nano helloworld.go

Add the following code.

package main
import "fmt"
func main() {
	fmt.Printf("hello, world\n")
}

Save and close the file when you are done.

Step 3 – Run the Golang Application

Now, change the directory to helloworld and initialize the application using the following command.

cd /root/go/src/helloworld
go mod init

Next, build the application with the following command.

go build

Now, run your application using the following command.

./helloworld 

If everything is fine, you will see the following output.

hello, world

Conclusion

In this post, we showed you how to install Golang on Fedora Linux. You can now start building your own Golang application and hosted it in the production environment. You can now use Golang on dedicated server hosting from Atlantic.Net!