Home > Backend Development > Golang > How to install win7 go language

How to install win7 go language

藏色散人
Release: 2023-01-11 09:23:06
Original
4254 people have browsed it

win7 Go language installation method: first download the golang program installation package; then define the installation directory and configure environment variables; then enter the "go version" command in the cmd window to view the version number; finally install LiteIDE development Just tools.

How to install win7 go language

The environment of this article: Windows7 system, Go1.11.2 version, thinkpad t480 computer.

Recommended tutorial: "go language"

Building a go language development environment under win7 (64bit)

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
The Go language is specially optimized for programming multi-processor system applications. Programs compiled using Go can be as fast as C or C code, are more secure, and support parallel processes.
Learning Go is partly out of interest, and partly to be exposed to more application scenarios by becoming familiar with another language.
The installation steps are as follows:
1. Download the program installation package:
Installation program download address: https://golang.org/dl/ (wall download address http://www.golangtc.com/ download),
Since there are two types of installation packages under Windows: msi and zip; zip is installation-free and can be used after decompressing and configuring some environment variables; msi is the installation package version, which can be installed The corresponding environment variables will be set. My system is win7, 64-bit. For convenience, I chose go1.11.2.windows-amd64.msi. For others, please download according to the version you need;

2. Installation and environment configuration
The installation process is simple, just "next" all the way, you can also define the installation directory, msi will automatically configure some environment variables, you can also configure the environment variables yourself, check the environment after configuration Are the variables correct?
The main environment variables are as follows:
GOROOT: Go installation directory
GOPATH: The directory used to store the Go language Package. This directory cannot be in the Go installation directory
GOBIN: Go Binary file storage directory, just write %GOROOT%\bin
GOOS: operating system
GOARCH: specify the system environment, i386 means x86, amd64 means x64
PATH: %GOBIN% needs to be added to the PATH variable Finally, it is convenient to run Go under the command line. It should be noted that the go command depends on an important environment variable: GOPATH. Before go1.8, this environment variable required the user to set it. But after go1.8 version, there will be a default value if there is no setting. It is: GOPATH under Unix/Linux/macOS. Before go1.8, this environment variable required users to set it. But after go1.8 version, there will be a default value if there is no setting. It is: HOME/go directory under Unix/Linux/macOS, and it is: %USERPROFILE%/go directory under Windows.

Here is my configuration $GOPATH: D:\data

Configure environment variables, "Computer" - "Properties" - "Advanced System Settings" - "Environment Variables"

After completion, enter in the cmd window: go version

3. The environment is set up and the development tools are installed. LiteIDE is recommended here.

Download address: https://sourceforge.net/projects/liteide/files/

Select the latest version:


liteidex35.2.windows-qt5.9.5.zip

Download the compressed package and unzip it to the D:\ drive. After the installation is complete, open the application, "Tools"->"Edit Current Environment", and confirm the GOROOT variable and GO installation path. Consistent:

"Tools"->"Manage GOPATH"

4. Create a new small project

5. Running results

Use the shortcut key "ctrl r"

##


In this way, the development environment of GO is completely set up!
Generally, the GOPATH directory has three subdirectories: 1. src stores the source code (for example: .go.c.h.s, etc.); 2. The files generated after pkg compilation (for example: .a); 3. The files generated after bin compilation can Execution file (for convenience, you can add this directory to the GOPATH directory and agree to have three subdirectories: 1. src to store the source code (for example: .go.c.h.s, etc.); 2. The file generated after pkg compilation (for example: .a); 3. The executable file generated after bin compilation (for convenience, you can add this directory to the PATH variable);
The bin and pkg directories do not need to be created, the go command will automatically create them (such as go install), they only need to be created src directory.
If there are any deficiencies in the above, or suggestions, you are welcome to criticize and correct them.

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template