This is a creation in Article, where the information may have evolved or changed.
Go language
- Parallel and distributed
- Software engineering support
- Programming philosophy
Executive Body
Go language Features
自动垃圾回收更丰富的内置类型函数多返回值错误处理匿名函数和闭包类型和接口并发编程反射语言交互性
#环境的搭建yum -y install golang
Hello World
root@122159d23f8e:~# cat hello.gopackage mainimport"fmt"func main(){ fmt.Println("Hello world!")}root@122159d23go run hello.go Hello world!root@122159d23
Built-in types
go The language contains the following basic types: Boolean type: bool . Integral type: int8 , byte , int16 , int , UINT , uintptr , and so on. Floating-point type: float32 , float64 Complex Type: complex64 , complex128 . String: string . Character type: rune . Fault type: Error. In addition, the go language supports these composite type pointer (pointer) array (array) slices (slice) dictionaries (map ) channels ( chan ) struct (struct ) interface ( interface )
#数组特点 value type If you use an array as the parameter type for a function, the parameter will occur when the function is called for data replication. Therefore, the contents of the incoming array cannot be modified in the body of the function, because only one copy of the incoming array is manipulated inside the function. #数组切片