Golang Basics - Quick experience of Golang based on the Goland editor

[Original Link] Golang Basics - Quick Experience of Golang Based on Goland Editor

(1) Open Goland and click "New Project"

(2) Set the project storage location and project name, then click "Add SDK", then click "Local"

(3) Select the installation path of Golang and click "OK"

(4) Then click "Create"

(5) Then right click on the project name, click "new" and then click "Go File"

(6) Create a new man.go file and write the following code

package main

import "fmt"

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

(7) Then right-click in the file - execute, you can run the go code, the execution result is as follows

(8) At this time, you can also execute the go run . command in the terminal, as shown below

(9) In addition, it can also be compiled into a binary file through go build, and then directly execute the binary file, as shown in the figure below

(10) If you delete the binary file, you can directly pass the go clean command, as shown in the figure below

Guess you like

Origin blog.csdn.net/redrose2100/article/details/130417838