How to Install a package with GO get?
In the Go language, we can use the go get command to download and install the packages and dependencies. Various repositories have the support to go get like Azure Repos Git and GitHub Repos. Executable is installed in the directory named by the GOBIN environment variable which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set. In this article, we will install a package using the go get command. Here, we will be using Linux Operating System.
Note: Make sure you have the Golang environment set on your operating system.
Installing a Package using go get
To install a package using go get follow the following steps:
Step 1: Make sure to check whether the Golang is installed on your system by checking the version of Go.
go version
Step 2: Set the GOPATH by using the following command.
export GOPATH=$HOME/go
Step 3: Now, set the PATH variable with the help of the following command.
export PATH=$PATH:$GOPATH/bin
Step 4: Now, check the ./bashrc file in Linux whether the path variables are successfully set or not.
nano ~/ .bashrc
Step 5: Below is the GitHub repository which we will be downloaded by using the go get command.
https://github.com/haccer/subjack
Step 6: Use the following command to download the repository to the local file system.
go get github.com/haccer/subjack
Step 7: Install the executable by using the following command.
go install -v github.com/haccer/subjack@latest
Step 8: The repository is been successfully downloaded and we are just checking the help section of the repository.
subjack -h
Please Login to comment...