Readers
IO package specified IO. The reader interface, which represents reading from the end of the data stream.The Go standard library contains many implementations of this interface, including files, network connections, compression, encryption,
From my space to turn over, the space address for http://user.qzone.qq.com/29185807/blog/1458275362
Let's start with the HTTP server for the go language.
First look at the net/http bag.
In the server structure, there are many parameters, where
Or the old, go in the development of the network module is indeed convenient and incomparable, the use of goroutine characteristics is simply a duck, ready to use go to do a CS chat room, the overall code less than 1000 lines, the core code may be
Go
string concatenation for string: direct = = for stitching
var s string
str: = "123"
str = "123123"
str = "Qwerqwe"1 2 3 4 use sprintf
var s string = "12312SF"
s = fmt. Sprintf ("%s%s", S, "123123")1 2 for []string use strings. Join for
The classification of Chan
Divided into 2 categories with cache and no caching, especially the use of caching, to prevent the pit from falling.
With no cacheMake (Chan data type)
With cacheMake (Chan data type, length)
For example, define a
A batch is one or more statements executed by a client application as a unit to SQL Server if an error occurs in a batch, the entire batch is not handed to SQL Server for executionPRINT 'First Batch';GO--Invalid BatchPRINT 'Second
(Transferred from: https://blog.csdn.net/Jeanphorn/article/details/79018205)
Programme evolution
1. Direct use of Goroutine
With the support of the Go language native concurrency, we can directly use a goroutine (as follows) to process this request
Import
:= =
c := 1 // error non-declaration statement outside function bodyd = 1 // error non-declaration statement outside function body
Func Test () {c = 1//undefined:should be c:=1D = 1var F, D intF,d = Cal ()Fmt. Println (c, F, D)}
Right
In the go language, the bottom string is stored in a byte array and cannot be changed.
For example, the s:="Go编程" fmt.Println(len(s)) output should be 8 because the Chinese characters are stored in 3 bytes.
len(string(rune('编')))The result is 3.
In the previous section we have learned about the configuration of the go environment and do not know it, please review the previous article https://www.cnblogs.com/zhangweizhong/p/9459945.html, this chapter we will learn the basic grammar of the go
"Download Address"
The most classic go language work in the world, the experience of the pioneer Mark Summerfield of Go language programming is summarized.
This is a Go language combat guide that helps you understand the go language, think in the
# Wxpay for Golang Note: I pay the official SDK Java version, with the Go language implementation of a payment SDK, with the Java version of the features, with a light-weight easy to use, and full-featured features, theoretical performance will be
ReproducedGo basic Learning Record-write Web application-readjust project directory structure (ii)The previous article organized a part of the file structure, this time again will be the remaining part of the processing, in fact a small part,
The
A few ways to get the length of a string
-Use bytes. COUNT () statistics
-Use strings. COUNT () statistics
-Convert string to []rune after calling Len function for statistics
-Use UTF8. Runecountinstring () Statistics
Cases:
Install Go
The pros and cons of Go language, here is not introduced, the following directly talk about the installation of Go:
Go official website : http://golang.org/(requires FQ software)
Domestic Download Address :
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service