Install & Run
Always remove previous versions before installing newer ones.
Install
Manually
Officially, Go docs tells to manually download the latest version and install it.
wget https://go.dev/dl/go1.xx.x.linux-amd64.tar.gz
sudo rm -rf /opt/go && sudo tar -C /opt -xzf go1.*.linux-amd64.tar.gzAdd this env to .bashrc.
export PATH=$PATH:/usr/local/go/binVersion manager
There is a version manager kind of like python pyenv.
It automatically adds the Path variables to .bashrc and installs the latest Go version.
wget -qO- https://git.io/g-install | sh -sOther commands:
# Download and set version to latest
g install latest
# Download and set to <version>
g install <version>
# List installed versions
g list
# List all versions
g list-all
# Remove all versions, except the current used one
g pruneCompile & Run
Run uncompiled
Run an uncompiled file.go file with:
Compile
To build and generate an executable the project needs a .
Run compiled
In Windows the compiled will be a .exe file, whether in Linux or Mac it will be a executable file.
Last updated