Go 语言从hellod,Word!开始
cd 自定义文件
- 为第一个Go源代码创建一个hello目录
mkdir hello
cd hello
- 为代码添加依赖项
$ go mod init example/hello
go: creating new go.mod: module example/hello
4.在文本编辑器中,创建一个文件hello。去哪里写代码。
将以下代码粘贴到您的hello中。点击file并保存文件。
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
5.运行代码从,查看打印
$ go run .
Hello, World!