Go的内置关键字(25个) 不多
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continute for import return var
Go的注释方法(和js一样)
单行注释: //
多行注释: /**/
Go程序一般结构 common_structure.go
- 通过 package 组织代码结构(类似python的模块)
- 只有 package 名称为 main 的包可以包含 main 函数
- 一个可执行程序 有且仅有一个 main 包
- 通过 import 来导入包
- const 用来定义常量(类似c)
- 函数体外部使用 var 来进行全局变量的声明和赋值
- 复杂类型 struct , interface 要用 type 关键字来声明
- func 来声明函数
简单的demo