This is a created article in which the information may have evolved or changed.
In the Go language. The order is not so important, accustomed to the complexity of C, for simple practices sometimes appear unreal feeling. A Go language source file structure: Package ***import ***,***,***var|func|type|const write C program If each function is called. Be sure to see the form of the function where it is called, and for variables, macros are like this. To go language, no, this simple example, is the main function that can work refers to the following declaration but struct, func, var. No harm! Package Mainimport "FMT" Const (K1 = +) Func main () {var i = k1fmt.println ("i", i) var j = k2fmt.println ("J", J) P: = Point {3,4}fmt. Println (p.x, p.y) d: = Distance2 (P) fmt. Println ("D:", D) fmt. Println ("Z:", z)}const (K2 = $) func Distance2 (P point) int {return p.x*p.x+p.y*p.y}type point struct {X inty Int}va R Z = 200
Src:
Http://www.ieyebrain.com:8080/devel/go/src/learn/var_order.go