Golang (Go) is a programming language that are becoming more and more popular and I have seen many interesting tools that are written in Go. Since Go are not being installed by default in Kali Linux I thought that publishing a quick-start guide could be a good idea.
- Start by open your web browser and visit https://golang.org/dl/
- Download the latest version for Linux – “gox.xx.x.linux-amd64.tar.gz”
- Open your terminal and navigate to your downloads folder
cd /root/Downloads
- Extract the files
tar -C /usr/local/ -xzf go1.13.6.linux-amd64.tar.gz
- Add variables for GO by modifying “~/.bashrc”
vim ~/.bashrc
Add the following paths to the end of the fileexport GOPATH=/root/go-workspace
export GOROOT=/usr/local/go
PATH=$PATH:$GOROOT/bin/:$GOPATH/bin - Now we need to refresh the bashrc to get the updated variables
source ~/.bashrc
- Now we just need to verify that everything is correct configured and we can do that by creating a simple ‘hello world’ program in Go.
vim helloworld.go
Add the following code to the file:package main
Then save the file and try to run the program:
import "fmt"
func main() {
fmt.Printf("Hello world!\n")
}go run helloworld.go
If everything was configured correctly you should see something like this:
You are now ready to use Golang on your Kali Linux machine!