Home > Backend Development > Python Tutorial > Take you step by step to configure the Golang environment

Take you step by step to configure the Golang environment

WBOY
Release: 2023-04-10 13:51:03
forward
1674 people have browsed it

Preface

Hello everyone, I am Zhou Ba, a three-year coder who has to comb his only three hairs in front of the mirror every day

Let’s arrange it this time 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 default highest version, the Go code is downward compatible, and the difference between versions The difference doesn’t matter

Take you step by step to configure the Golang environment

Installation

1. Find the downloaded installation file.

Take you step by step to configure the Golang environment

2. Double-click to install

Take you step by step to configure the Golang environment

3. Select Agree

Take you step by step to configure the Golang environment

4. Customize the installation location.

Take you step by step to configure the Golang environment

5. Click install to install.

Take you step by step to configure the Golang environment

#6. The installation is in progress, wait until the installation is completed.

Take you step by step to configure the Golang environment

7. Click finish to complete the installation.

Take you step by step to configure the Golang environment

Check whether the installation is successful

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

Take you step by step to configure the Golang environment

Note: Since it is already version 1.11, we will use go mod to manage dependencies in the future, and there is no need to configure GOPATH Waiting for weird stuff.

Configuring GOPROXY (agent)

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

But the default official website source, GOPROXY=https://proxy.golang.org,direct, cannot be accessed in China

Enter go env to view the Go configuration

Take you step by step to configure the Golang environment

Needs to be modified to a domestic mirror site, here is the recommendation:

https://goproxy.io
Copy after login

Execute the following command to make modifications

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

Reopen ​CMD​, Execute go env to view the Go configuration

Take you step by step to configure the Golang environment

##Go development editor

Go current development editor There are two main types of servers: VSCode and Goland. The recommendation for this tutorial is Goland, which belongs to the same company as Pycharm. The installation and cracking of Goland will not be described here.

Why didn’t I choose VSCode

When I first started writing Go, I actually used VSCode, but when I used it, I found that VSCode always did not automatically prompt, and the automatic save setting often fails automatically. After several twists and turns, I still embraced the IDE specially developed for Go, Goland!!!, it’s really delicious.

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

Related labels:
source:51cto.com
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