package main
import "fmt"
func main() {
fmt.Println("Hello, World")
}
输出:
Hello, World
第一行是包裹减速, 包裹的名称是main。对于所有go程序, 都必须减速包裹。
下一行是导入语句, 这里我们要导入“ fmt”。编译器将包括软件包fmt的文件。
下一行是main()函数, 所有执行均从main函数开始。
下一行fmt.Println(…)是Go中可用的函数。此功能将在屏幕上显示消息“ Hello, World”。
如何运行Go程序:
我们已经将该程序保存为Hello.go。要运行该程序, 请打开命令提示符并输入:
go run Hello.go
输出:
Hello, World
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_50048.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57