“This is the 10th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”
Hello, I’m looking at the mountains.
This article is from the concurrent programming network translation invitation, the article from Go official website.
Follow these steps for a quick installation.
If you want to install from source, you can visit: Install the Go environment from source.
If you want to install or uninstall multiple versions of Go, you can visit: Manage the Go environment.
download
The following lists the paths to download the Go language installation packages for Linux, Mac, and Windows operating systems:
- Linux:golang.org/dl/go1.16.5…
- Mac:golang.org/dl/go1.16.5…
- Windows:golang.org/dl/go1.16.5…
For other operating systems or versions, visit golang.org/dl/.
By default, the go command uses the Module mirroring service and checksum verification provided by Google to download and verify modules by default. The full go command and configuration can be obtained from golang.org/cmd/go/.
The installation
Linux
-
To unpack the downloaded package into the /usr/local directory, run the following command (switch to root or use sudo) :
Rm -rf /usr/local/go tar -c /usr/local/xzf go1.16.5.linux-amd64.tar.gzCopy the code
Note: This command will delete the previously installed GO environment, so it is best to make a backup before executing it.
-
To add /usr/local/go/bin to the PATH environment variable, add the following command to $HOME/. Profile or /etc/profile:
export PATH=$PATH:/usr/local/go/bin Copy the code
Note: Changes to the configuration file do not take effect until the next time you log in to the computer. To take effect immediately, you can either run the shell command directly or re-configure the configuration using the source $HOME/.profile command.
-
Open the terminal and enter the following command to verify whether the command is successful:
go version Copy the code
-
Verify that the printed version number is consistent with the downloaded version number. If yes, the command is successful. If the command cannot be found or the version is inconsistent, the installation is faulty. If possible, it is best to restart the system and verify again to avoid misconfiguration of environment variables.
Mac
-
Double-click to open the downloaded installation package and install it as prompted. The installation package installs Go directly into the /usr/local/go directory and adds /usr/local/go/bin to the PATH environment variable. You may need to restart the terminal for the environment variables to take effect.
-
Open the terminal and enter the following command to verify whether the command is successful:
go version Copy the code
-
Confirm the printed version number
Windows
- Double-click to open the downloaded installation package and install it as prompted. By default, it will be installed in
Program Files
orProgram Files (x86)
Directory, can also be modified according to their own habits. After the installation, restart the terminal for the environment variables to take effect. - Verify that the installation is successful
- In Windows, open the menu
- Type in the search box
cmd
Then press Enter to open the terminal - In terminal, enter the following command
go version Copy the code
- Confirm the printed version number
Start coding
Now that you have successfully installed the Go environment, visit Getting Started tutorial to begin your Coding journey.
Hello, I’m looking at the mountains. Swim in the code, play to enjoy life. If this article is helpful to you, please like, bookmark, follow. Welcome to follow the public account “Mountain Hut”, discover a different world.