A systematic review of Golang knowledge, today summarizes some of the characteristics of the channel and some simple implementation.Don ' t communicate by sharing memory;share memory by communicating.
1, the channel type itself is concurrency-safe,
As is known to all, the Golang map is non-coprocessor safe (go1.6 version, after go1.6 read security), and the need for concurrent read and write map should be very common. Examples are as follows:
package mainimport "fmt"func main() { a :=
Golang Package Reference parsing
The environment variable is configured as follows:
goroot----[ C:\Go ]
gopath----[ F:\workspace\go_home ]
The VS code is configured as follows:
F:\workspace\go_homeIs the total golang workspace, create
Install Golang to the latest version and check
> //低于下面的版本去 golang.google.cn 升级 Golang> go version> go version go1.11 darwin/amd64
Setting the environment variable open function
> //下面是临时开启,写到 bashrc 或者 zshrc 来永久开启> export GO111MODULE=on
Environment
Go Download Install
Recommended go to Golang Chinese community download go compilation organ party download
A fool-type installation can
Open cmd after installation, enter go version the successful output version number to indicate
Because of the company arrangement, I temporarily moved from the Java project team to the Go Project team, after almost 5 days of spare time to go to study, the architect let me to the company colleagues Golang sharing and training.Colleagues were
1 Add elements to slice, we use append to bring the function.
From the above steps we know s2=[5,6], continue to add data to slice more than the CAP, the system itself will open up a new underlying array for ease of use, but also remove the unused
0149_ the maximum number of points on a line
Title Description
Given a two-dimensional plane, there are n points on the plane, and the maximum number of points on the same line
Example 1:
输入: [[1,1],[2,2],[3,3]]输出: 3解释:^|| o| o| o+-------
Go language Features:Type checking: Compile-timeOperating environment: Compiled into machine code to run directlyProgramming Paradigm: interface-oriented, functional programming, concurrent programmingGo concurrency programmingUsing CSP
One. Program Entities and KeywordsAny go language source files are made up of several program entities. in the Go language, variables, constants, functions, structs, and interfaces are collectively referred to as "program entities", and their names
One, find some type of child control and return a list collection PublicList getchildobjects (DependencyObject obj, Type TypeName)wheret:frameworkelement {DependencyObject child=NULL; List childlist =NewList(); for(inti =0; I 1; i++) {
Write it in front.
Recently, in the development of the Go Project, it was found that the go language itself error does not panic display detailed debugging information like a trigger. For complex systems, this will give our developers some time to
# # # Written in front of the words recently in the development Go project, found that the go language itself "error" does not appear as the trigger ' panic ' when the detailed debugging information. For complex systems, this will give our
Take a random number
package mainimport ( "fmt" "math/rand" "time")func main() { //step1: 设置种子数 rand.Seed(time.Now().UnixNano()) //step2:获取随机数 num4 := rand.Intn(100) //[0,100) fmt.Println(num4)}
Take from what start to what
Grammar
参数名 ... 参数的类型
Note the point:
If the parameter of the function is a mutable parameter, there are other parameters as well. The variable parameter should be placed at the end of the formal parameter list
There can be at most one
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.