[关闭]
@xxliixin1993 2016-07-20T02:21:55.000000Z 字数 329 阅读 1031

Go 初识

golang


hello world

  1. package main
  2. import "fmt"
  3. func main() {
  4. fmt.print('hello,world')
  5. }
  1. 运行
  2. root@PC:/lixin/go/src# go run hello.go
  3. hello, world
  4. 编译,会生成
  5. root@PC:/lixin/go/src# go build hello.go
  6. root@PC:/lixin/go/src# ./hello
  7. hello, world

package main 必须首先出现,紧跟着是 import。在 Go 中,package 总是首先出现,
然后是 import,然后是其他所有内容。当 Go 程序在执行的时候,首先调用的函数
是 main.main() ,这是从 C 中继承而来。这里定义了这个函数;

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注