安装GO开发环境
[root@localhost ~]# yum install golang
GO的Hello world
[root@localhost ~]# cat hello.go package main import ( "fmt" ) func main() { fmt.Println("Hello world") } [root@localhost ~]#
直接运行
[root@localhost ~]# go run hello.go Hello world [root@localhost ~]#
编译成机器码,并运行
[root@localhost ~]# go build hello.go [root@localhost ~]# ./hello Hello world [root@localhost ~]#