Struct fields can be accessed through a struct pointer.

To access the field X of a struct when we have the struct pointer p we could write (*p).X. However, that notation is cumbersome, so the language permits us instead to write just p.X, without the explicit dereference.

functions

Named return values Go's return values may be named. If so, they are treated as variables defined at the top of the function.

导出名

Exported names: In Go, a name is exported if it begins with a capital letter. For example, Pizza is an exported name, as is Pi, which is exported from the math package.

When importing a package, you can refer only to its exported names. Any "unexported" names are not accessible from outside the package.

分号自动插入规则

注意使用 go.fmt 进行格式化,按照语法格式写,否则会有意料之外的结果。

Go 语言小细节——分号自动插入规则_s13335358730 的博客-CSDN 博客