This issue of nine stars to take you to understand the Go language development environment. Among the programming languages I have contacted and learned, I think the environment construction of Go is the easiest. First, let’s take a look at a small demo and output Hello World on the console.

This prints Hello World on the console, which is very simple.

Next, we carry out the actual operation of environment building:

1. Download the installation package

Go, Golang official website download: golang.google.cn/; Back home, because of the wall…

Since MY system is macOs, I download this installation package.

2, after downloading, directly double-click to install:

Because it is relatively simple, the nine stars will not be repeated here.

3, after the installation, open the terminal, enter go env, and then press Enter, if there is any content, it indicates that the installation is successful.

For package management, we use go mod, so we won’t talk about how to configure Gopath.

4. Regarding ides, the coding tools I currently use are GoLand, vscode, sublime text. IDE choice according to personal preferences, with the habit on the line. Here nine stars use GoLand to write a small demo to get the current time, showing how to write a program after the environment is installed.

A few points to note here:

(1) In Go, the curly braces of the function must be on the left.

(2) The package name of the main function must be main.

(3) import indicates the import package.

The above content is nine star personal opinion, if there is incorrect place, also hope the comments will be corrected.

In the spirit of simplicity and ease of use, we will not repeat this period, next time we will start a brief introduction to the basic syntax of Go.

Only when you believe, can you persevere.