Go Getting Started Tutorial--Hello, World.

Zero, the text editor implements Hello, World.

The official tutorials are mainly for Linux or Mac systems. But it doesn't matter, it is also very simple to implement in windows.
0.1. Create a folder with any name, such as: hello
0.2. Create a hello.go file
0.3. Type the following code:

packag main

import "fmt"

func main() {
	fmt.Println("Hello, World!")
}

0.4. Open the terminal at the path under the hello.go file (such as here: D:\go-project\hello), type go run hello.go, and you can see the greeting as shown in the figure. So far, the printing of hello world based on the text editor is completed.
insert image description here

1. Editor selection for go code

According to the description on the official website, you can use any text editor for go coding. The more popular ones are VSCode (free), GoLand (fee required) and Vim (free). But compared to these editors, I personally prefer to write go code by installing the Go plugin in IDEA at this stage.
IDEA installs the Go plug-in, Go file creation and operation are described in detail, so I won't go into details here.
IDEA implements Go development
Here is a summary:

step1 : idea创建/打开Go项目的方式,跟我们平时创建/打开Java项目基本一致,无非就是创建项目的时候要选择GO语言,以及选定GOROOT
step2: IDEA开发GO语言的用户界面讲解(跟我们创建Java类以及运行main函数步骤也如出一辙。)
step3: 主要讲IDEA 如何帮你更好的编写go代码
step4: 讲如何run & debug 调试代码。
以上,就是通过idea编写go代码的主要步骤。

Please add a picture description
Just follow the tutorial:
insert image description here
Reference:

Guess you like

Origin blog.csdn.net/qq_37196265/article/details/130535985