@xxliixin1993
2016-07-20T02:21:55.000000Z
字数 329
阅读 1345
golang
package mainimport "fmt"func main() {fmt.print('hello,world')}
运行root@PC:/lixin/go/src# go run hello.gohello, world编译,会生成root@PC:/lixin/go/src# go build hello.goroot@PC:/lixin/go/src# ./hellohello, world
package main 必须首先出现,紧跟着是 import。在 Go 中,package 总是首先出现,
然后是 import,然后是其他所有内容。当 Go 程序在执行的时候,首先调用的函数
是 main.main() ,这是从 C 中继承而来。这里定义了这个函数;