Linux/Mac/Windows,Golang安装教程,安装方法

# Linux/Mac/Windows,Golang安装教程,安装方法

1. Windows/mac其实没什么好说的 下一步下一步即可
2. Linux安装,从官方网站下载Linux版本 https://go.dev/dl/ 直接引用官方安装说明
“`shell
Extract the archive you downloaded into /usr/local, creating a Go tree in /usr/local/go.
Important: This step will remove a previous installation at /usr/local/go, if any, prior to extracting. Please back up any data before proceeding.

For example, run the following as root or through sudo:

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
Add /usr/local/go/bin to the PATH environment variable.
You can do this by adding the following line to your HOME/.profile or /etc/profile (for a system-wide installation):

export PATH=PATH:/usr/local/go/bin
Note: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source HOME/.profile.

Verify that you’ve installed Go by opening a command prompt and typing the following command: go version
Confirm that the command prints the installed version of Go.
“`

> 将下载的存档解压缩到 /usr/local,在 /usr/local/go 中创建一个 Go 树。
> 重要提示:此步骤将在解压之前删除 /usr/local/go 上的先前安装(如果有)。 请在继续之前备份所有数据。
>
> 例如,以 root 身份或通过 sudo 运行以下命令:
>
> rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
> 将 /usr/local/go/bin 添加到 PATH 环境变量中。
> 您可以通过将以下行添加到您的 HOME/.profile 或 /etc/profile (用于系统范围的安装)来做到这一点:
>
> 导出 PATH=
PATH:/usr/local/go/bin
> 注意:对配置文件所做的更改可能要等到您下次登录计算机时才会生效。 要立即应用更改,只需直接运行 shell 命令或使用诸如 source HOME/.profile 之类的命令从配置文件中执行它们。
>
> 通过打开命令提示符并键入以下命令来验证您是否已安装 Go:
>
去版本
> 确认该命令打印已安装的 Go 版本。

[具体详情可以参考: https://go.dev/doc/install](https://go.dev/doc/install)