--- date: [2021-10-19] --- # g g is a [[Package Manager]] for [[Go]]. ## Installation You can install g via [[cURL]]: ```bash curl -sSL https://git.io/g-install | sh -s ``` Restart your shell sessions after installation. > [!warning]- Error: g not found > Restart your shell sessions after installation and before using g or Go. Otherwise, you might get an error saying `g not found` ## Usage As with other package managers, you can use g to install multiple versions of [[Go]] and choose which one you want to switch to. This is useful when developing or using tools based on different versions. ```bash Usage: g [COMMAND] [options] [args] Commands: g Open interactive UI with downloaded versions g install latest Download and set the latest go release g install <version> Download and set go <version> g download <version> Download go <version> g set <version> Switch to go <version> g run <version> Run a given version of go g which <version> Output bin path for <version> g remove <version ...> Remove the given version(s) g prune Remove all versions except the current version g list Output downloaded go versions g list-all Output all available, remote go versions g self-upgrade Upgrades g to the latest version g help Display help information, same as g --help Options: -h, --help Display help information and exit -v, --version Output current version of g and exit -q, --quiet Suppress almost all output -c, --no-color Force disabled color output -y, --non-interactive Prevent prompts -o, --os Override operating system -a, --arch Override system architecture -u, --unstable Include unstable versions in list ``` [^stefanmaric] [^stefanmaric]: https://github.com/stefanmaric/g