sudo apt update
sudo apt install golang -y
# OR
wget https://go.dev/dl/go1.20.5.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz
Update your PATH
cat << 'EOF' >> "${HOME}/.zshrc"
# Add ~/go/bin to path
[[ ":$PATH:" != *":${HOME}/go/bin:"* ]] && export PATH="${PATH}:${HOME}/go/bin"
# Set GOPATH
if [[ -z "${GOPATH}" ]]; then export GOPATH="${HOME}/go"; fi
EOF
fi
# now source .zshrc to initialize the changes
source ~/.zshrc
mkdir –p ~/projects/goforit && cd ~/projects/goforit
git init
go mod init github.com/USERNAME/PROJECTNAME
- Initialize Cobra and add a subcommand
go install github.com/spf13/cobra-cli@latest
cobra-cli init
cobra-cli add scan
go mod tidy
go get github.com/spf13/viper
go mod tidy
make -f Makefile lint
make -f Makefile test
Step through the code with a debugger of your choice.
go get -v github.com/Ullaakut/nmap/v2
go mod tidy
go get -v github.com/asaskevich/govalidator
go mod tidy