This is a created article in which the information may have evolved or changed.
Curly braces for Golang:
In go, the curly brackets that inherit the C-series are indicated as a scope block, but different from the curly brace position in C/D + +, go requires that "{" must be on the right side (one line of code), not a separate line.
Variables for Golang:
In go, unused variables or packages can cause compilation errors, which is a mandatory behavior that cannot be changed to warnings, making code debugging a little cumbersome.
It is particularly important to note that in go, if you return the address (pointer) of a local variable inside a function, the variable is stored in the heap by the compiler, not in the stack, so returning a local variable is a legitimate behavior.
Golang Array and slice:
In go, array length can be self-inferred, slice slice can also be self-inferred, the difference between the two syntax is there is no ellipsis (...)
A: = [...] Int{1, 2, 3} //arrays: = [ ]int{1, 2, 3} //slice
Golang expression:
In Go, i++ is a statement rather than an expression, so j = i++, FMT. A statement such as Printf ("%d", i++) is wrong. In addition, go does not have a predecessor + +, that is, there is no ++i this statement.
Golang Charter System:
The package keyword is used to define a bundle. The filename of the source file does not need to match the package name. The package name uses lowercase letters, and lowercase is convention rather than mandatory. A package of go can consist of one or more files (unlike Java a package is a file), files that belong to the same package use the same "package name " to name a package. Although you do not use the package name to determine the file name, use the package name to determine the directory name of the source file, that is, the package name must be the same as the package's source file's parent directory.