Hello world 经典例子:
package mainimport "fmt"func main(){ fmt.Println("hello world"); }
说明:fmt 包使用函数实现 I/O 格式化(类似于 C 的 printf 和 scanf 的函数), 格式化参数源自C,但更简单。
一.运行:go run hello-world.go
输出:hello world
二.编译:go build hello-world.go
输出文件: hello-world
运行: ./hello-world