[OpenYurt deep analysis, Java programming tutorial video
To implement a reverse proxy for caching data, the first idea is to start from response The data is read from the body, and then returned to the requesting client and the local Cache module respectively. The pseudo code is as follows:
func HandleResponse(rw http.ResponseWriter, resp *http.Response) {
bodyBytes, _ := ioutil.ReadAll(re ...
Added by th3void on Tue, 14 Dec 2021 21:15:32 +0200
go concurrency control - WaitGroup
WaitGroup
preface
WaitGroup is a concurrency control technology often used in the process of Golang application developmentWaitGroup
It can be understood as wait goroutine groupThat is, wait for a group of goroutine s to end For example, a goroutine needs to wait for other goroutines to complete
Then it can be easily implemented usi ...
Added by darkhappy on Tue, 14 Dec 2021 08:33:34 +0200
Analysis of go underlying series defer principle
Analysis of go underlying series defer principle
defer
preface
defer statement
Used to delay the call of a functionEvery time defer pushes a function onto the stackBefore the function returns, the delayed function is taken out and executed We call the function that creates defer the master functionThe function following the defer stat ...
Added by youknowho on Sat, 11 Dec 2021 11:01:54 +0200
go series - string underlying implementation
String
The go standard library builtin defines all built-in types. The source code is located in Src / builtin / builtin go
string is a collection of 8-bit bytesUsually, but not necessarily, UTF-8 encoded text.In addition, two important points were mentioned:
string can be null (length 0), but not nilstring object cannot be modified ...
Added by Person on Sat, 11 Dec 2021 03:13:06 +0200
Why don't I recommend fmt.Sprintf
In daily programming, using fmt.Sprintf can easily splice strings, but did you know that fmt.Sprintf, which is harmless to humans and animals, is actually a performance killer.
In daily coding, we usually use the following methods to splice strings
// 1. + operator
str := str1+str2
// 2. fmt.Sprintf
str := fmt.Sprintf("%s %s",str1,str2)
/ ...
Added by smileyriley21 on Wed, 08 Dec 2021 20:24:16 +0200
golang process control summary
Process control in go languageThis article video tutorial address: https://www.bilibili.com/vide...Conditions in go languageConditional statements are used to judge whether a given condition is satisfied (whether the expression value is true or false) and determine the execution according to the judgment result (true or false). The same is true ...
Added by john_bboy7 on Wed, 08 Dec 2021 06:29:24 +0200
My first experience of go + language - writing a picture, downloading an artifact and a hundred lines of code with go +
preface
Recently, I encountered a shortage of pictures (I have to attach some pictures every time I write an article). Before I went to shopify, I downloaded some pictures one by one, but I soon ran out of them. Just recently, I studied go + with my friends in the go + community. I wanted to use go + to write a tool for downloading pictures in ...
Added by PHP Novice on Wed, 08 Dec 2021 06:09:09 +0200
Go language learning checking and patching Day3
Author: Regan YueSource: Hang Seng LIGHT cloud communityGo language learning checking and patching Day3Zero. PrefaceBecause I have a weak foundation, I often encounter a lot of confused problems when using Go language, so I am determined to check and fill in the gaps in Go language. This [Go language checking and filling in] series is mainly to ...
Added by horsleyaa on Tue, 07 Dec 2021 14:52:14 +0200
Write an HTTP forward proxy
concept
First, let's understand the related concepts of HTTP proxy. Generally speaking, there are two types of HTTP proxy, one is forward proxy and the other is reverse proxy. Although they are all proxies, there are still differences.
The VPN we usually use is the forward proxy. We specify a server, and then connect to the server through the ...
Added by ununium on Tue, 07 Dec 2021 08:06:39 +0200
Go interview question: talk about the defer keyword you understand
Hello, I'm brother Xiao Dao.The defer keyword is a go language feature often used in our work, and it is also a knowledge point favored by the interviewer. Today, I will take you to master it thoroughly through this article.Two features of deferdefer is a keyword in golang. It has two main features:Delayed invocation: execution is executed afte ...
Added by scottchr226 on Sat, 04 Dec 2021 04:56:15 +0200