How to Install Golang in Termux

Learn How to install golang in Termux

Goland or Go language is a popular open-source programming language developed by Google engineers, and it is one of the faster languages, 

In this tutorial, you will learn how to install glang in Termux step by step.

Before we begin, ensure that you have Termux installed on your Android device. You can download it from Fdroid. You should have some basic knowledge of termux commands

golang in termux

To install Golang in Termux, follow these steps:

1. Open Termux and update the package repository by running the following command:

pkg update && pkg upgrade -y

2. Install the Golang package by running the following command:

pkg install golang

3. Once the installation is complete, verify that Golang is installed correctly by running the following command:

go version

go version


You should see the version number of Golang displayed in the output.


4. To set the environment variables required for Golang to work properly, run the following commands:

export GOPATH=$HOME/go

export PATH=$PATH:$GOPATH/bin

These commands will set the GOPATH variable to the go directory in your home directory and add the bin directory to the PATH variable.


5. You can now create a new Golang project by creating a directory for your project and running the following command:

go mod init <project name>

This will create a new Go module in the directory you specified.

6. You can start writing your Golang code in the project directory.

That's it! You have successfully installed Golang in Termux and can start building your applications.


Conclusion

Installing Golang in Termux is a simple and straightforward process. By following the steps outlined in this article, you can easily set up a development environment and start writing your Golang code on your Android device. Happy coding!

Hi, I'm Basudev
A Professional Blogger & Hacker Interested in Infosec, Web Development, Programming

Post a Comment

Comments will be reviewed before publishing