Teach you step by step how to configure Golang environment

Release: 2023-07-20 16:27:15
forward
788 people have browsed it
This time we will arrange how to configure the Go language development environment on the win platform.

# Overall, Go configuration environment is quite easy, similar to Python, and environment variables will be added automatically.


Download address

Go official mirror site:

https://golang.google.cn/dl/
Copy after login

Just choose the highest default version, the Go code is backward compatible, Differences between versions don't matter

Teach you step by step how to configure Golang environment


#Install

1. Find the downloaded installation file.

Teach you step by step how to configure Golang environment

2. Double-click to install

Teach you step by step how to configure Golang environment

3. Select Agree

Teach you step by step how to configure Golang environment

##4.Customize Install location.

Teach you step by step how to configure Golang environment

##5. Click install to install.

Teach you step by step how to configure Golang environment

6. Installation is in progress, wait until the installation is completed.

Teach you step by step how to configure Golang environment

7. Click finish to complete the installation.

Teach you step by step how to configure Golang environment

Check whether the installation is successful

After the above installation process is OK, open the CMD window , enter the go version command, as shown

Teach you step by step how to configure Golang environment

Note:Since it is already version 1.11, we will use go mod to manage dependencies in the future, no configuration is requiredGOPATH and other weird stuff.


Configure GOPROXY (agent)

Maybe we need Use Go to download some packages or something.

But the default official website source, GOPROXY=https://proxy.golang.org,direct, is in Unable to access in China

输入go env查看Go配置

Teach you step by step how to configure Golang environment

需要修改成国内镜像站点,这里推荐:

https://goproxy.io
Copy after login

执行以下命令,进行修改

go env -w GOPROXY=https://goproxy.cn,direct
Copy after login

重新打开CMD,执行go env查看Go配置

Teach you step by step how to configure Golang environment

Go development editor

Go’s current development editors mainly include VSCode, GolandTwo kinds. The recommended ones for this tutorial are Goland, and PycharmBelong to the same company. The installation and cracking of Goland will not be described here.


Why didn’t you choose VSCode

When I first started writing Go, I actually used VSCode , but I found when using it, VSCode always does not prompt automatically, and the automatic save setting often fails automatically. I have experienced this several times. After much trouble, I finally embraced the IDE developed specifically for Go, Goland!!!, it’s so delicious.

The above is the detailed content of Teach you step by step how to configure Golang environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:Go语言进阶学习
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