First, the methodWhen a function is declared, a variable is placed before its name, which is a method. This additional parameter attaches the function to this type, which is equivalent to defining an exclusive method for the type. Such as:Package
The ' Package Mainimport ("FMT")//is divided into 2, certainly half is ordered by the Func binarysearchdef (data []int, key int, low int, high int) int {if Len (d ATA) = = 0 {return-1}//Note the critical value for low Data[low] {//If key is smaller
About the public number (this article has nothing to do)
Let me start with a brief introduction to myself, a Gen Y programmer who is currently working for big data startups in the United States, focusing on go and data processing. As a result of
Insertion Sorting algorithm principle:The sequence takes a number from the sequence and compares it to the element on the left, and if the left element is larger than the number taken, move to the right until the number is inserted at a position not
I in the daily Golang project development, the use of some third-party open source libraries, most of them are excellent open source projects, the source code worthy of serious reading research. Some of the libraries used in this record:
1. Parsing
instruction
Description
Notes
Go version
View version
Go run
Run the script
Go Install
Install self-packages or dependent packages
Go Build
Compiling and
Packages that use Context need to follow the following guidelines to satisfy interface consistency and facilitate static analysis
1. Do not place the Context in a struct, explicitly passing in the function. The Context variable needs to be used as
Writing Unit Test Cases
File name must end With ' _test.go '
Must import "testing" this package
The tests are executed in the order in which they were written in the source code.
Test the function ' testxxx (t *testing. T) ' parameter
Sync. Once can implement a singleton mode to ensure sync. Once.do (f func ()) is executed only once and can initialize an instance singleton.
Sync for Golang 1.9. Once, the same as the Golang 1.10. Source code location: Sync\once.go.
Structural
This article is the first Golang language learning tutorial
What is Golang?
The individual thinks that the novice has no understanding of the real features, and so on, so that they can really understand after the real learning. So the following
The most recent use of consul service registration as a project and the underlying functionality of service discovery. In the tower building cluster use encountered some pits, the following a record down.
Consul cluster Multiple node
The consul
Write the project always need to be serialized, heard, also saw a lot of students teachers on the various Golang json Library assessment. Why do I have to continue this assessment?Because the practice of knowledge is the most persuasive, but also
August 7 @ Yellow classmate asked me: "Data to Redis is gzdeflate compressed data, Golang out from Redis, decompression failed." Many business from PHP to Golang often encounter, so write down this blog post, hoping to help more people. to decode
1 What is the architect?
The first thing you need to know about the architect's direction is what is the architect?
An architect is a team leader who needs to take control of the whole and need to understand local bottlenecks and give solutions
1. Definition
A struct is an aggregated data type that combines a named variable of another or more arbitrary types.
2. Member variables
Access control mechanismIf the member variable name of a struct is larger than the first letter, then the
Linux and Windows 64-bit executables are compiled under MAC
Linux under Compile Mac and Windows 64-bit executable program
Windows compiles MAC and Linux 64-bit executables
SET CGO_ENABLED=0SET GOOS=darwinSET GOARCH=amd64 go build main.goSET
Go Language Environment Installation
Go install package download URL:
Golang China: https://www.golangtc.com/download
Go Language Chinese Web: https://studygolang.com/dl
There are two versions of Zip and MSI installed as per this download. (It
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.