Home  >  Article  >  How to install golang environment

How to install golang environment

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-06-09 09:47:151472browse

The environment installation method of golang is: 1. Right-click "This Computer" or "Computer Icon" and select the "Properties" option; 2. In the Control Panel window, click "Advanced System" on the right Settings"; 3. Click the "Environment Variables" button to open the "Environment Variables" dialog box; 4. Click "New" under "User Variables" and add a path variable; 5. Edit the "Path" variable to facilitate system search. ;6. Open the command line prompt and enter the "go -v" command to test whether the installation is successful.

How to install golang environment

Operating system for this tutorial: Windows 10 system, Go1.20.1 version, Dell G3 computer.

The environment installation method of golang is:

1. Right-click "This Computer" or "Computer Icon", and then select "Properties".

屏幕截图 2023-06-09 094211.png

#2. In the Control Panel window, click "Advanced System Settings" on the right.

屏幕截图 2023-06-09 094246.png

#3. Click the "Environment Variables" button to open the "Environment Variables" dialog box.

4. Click "New" under "User Variables" and add the following variables:

  • GOROOT: The path to the Go directory to which the installation package is extracted, for example : C:\go or D:\Go

  • ##GOPATH : The path for customizing the workspace, for example: C:\Users\your username\go

  • Note: If there is no GOPATH environment variable, create it and point it to any folder path.

5. Edit the "Path" variable and add %GOROOT%\bin;%GOPATH%\bin; to the end of the variable value so that the system can find go and any other files you have installed. Go tools.

屏幕截图 2023-06-09 094319.png

#6. To test whether your installation is successful, open a command line prompt and enter the go version command. If the correct version number of the installed version is output, the installation is successful.

屏幕截图 2023-06-09 094454.png

The above is the detailed content of How to install golang environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn