Simpler concurrent code, stronger concurrency control

Do you feel that Go's sync package is not enough? Have you ever encountered a type without sync/atomic support? Let's take a look at some value-added additions of go zero's syncx package to the standard library. https://github.com/tal-tech/go-zero/tree/master/core/syncx name effect AtomicBool bool ty ...

Posted by iamngk on Tue, 08 Mar 2022 11:10:39 +0100

Go replaces (overwrites) a line of the file

Go replaces (overwrites) a line of the file 1. Foreword There is such a requirement. After finding a line of content with a keyword in the file, we replace the line with the new content we need, such as modifying the network configuration file, modifying the picture address, modifying all keywords in the code, etc., which is similar to ...

Posted by alwoodman on Mon, 07 Mar 2022 23:47:51 +0100

Introduction to GO language foundation

This article mainly summarizes the basis of Go language and its related special grammar. Unlike Go build, Go run does not create executables. Therefore, in the development stage, use the command go run. When sharing after development, use Go build.At the beginning of its creation, Go language was used to develop high flow production system.In ...

Posted by warydig on Mon, 07 Mar 2022 13:04:59 +0100

There is no one of the strongest code self-test methods in history!

Special note: This is really not the title party. I have written code for 20 + years. I really think go fuzzing is the most awesome code self-test method I have ever seen. When I used the AC automata algorithm to improve the keyword filtering efficiency (by ~ 50%) and the processing mechanism of mapreduce for panic, I found the edge bug throu ...

Posted by egg82 on Mon, 07 Mar 2022 09:00:58 +0100

Thoughts on Go select deadlock

Thoughts on Go select deadlock https://mp.weixin.qq.com/s/Ov1FvLsLfSaY8GNzfjfMbg Continuous thinking triggered by the article Summary above Summary I package main import ( "fmt" ) func main() { ch := make(chan int) go func() { select { case ch <- getVal(1): fmt.Println("in first case") case ch <- getVal(2): fmt.Println( ...

Posted by Mick33520 on Mon, 07 Mar 2022 08:50:37 +0100

Golang standard library context Context

Golang standard library context Context In the Go http package Server, each request has a corresponding goroutine to process. Request handlers usually start additional goroutines to access back-end services, such as databases and RPC services. The goroutine used to process a request usually needs to access some data specific to the request, su ...

Posted by phpian on Sun, 06 Mar 2022 11:58:24 +0100

Code practice of several schemes often used in second kill anti oversold

https://www.jianshu.com/p/a2bd89e0d24b If you want to do well, you must sharpen your tools first. Let's install relevant tools first jmeter I demonstrated it on mac, so I'll install brew first ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2> /dev/null Using brew to install jmeter brew instal ...

Posted by Pethlehemm on Sun, 06 Mar 2022 10:26:19 +0100

Go language Bible Chapter 1

1, Introduction 1,hello world Go doesn't need a semicolonThe "{" symbol must be on the same line as the keyword func and cannot be on its own. In the expression of x+y, the newline character can be after the + operator, but not before the + operatorIn order to write the main method in multiple files under a package at the same time, ...

Posted by chacha102 on Sat, 05 Mar 2022 09:07:39 +0100

[Go advanced concurrent programming] Context

Context is a commonly used concurrency control technology in Go application development. Its biggest difference from WaitGroup is that context has stronger control over derived goroutines, which can control multi-level goroutines.Although there are many disputes, it is convenient to use context in many scenarios, so now it has spread in the Go ...

Posted by kaeRock on Sat, 05 Mar 2022 08:10:50 +0100

Non zero basic accelerated Go language_ Basic chapter

Non zero basic accelerated Go language_ Basic chapter There is no need to install the Go environment here. It is recommended that you prepare the Goland + Go environment Here are the features of all languages. See what's different about Go Plastic subdivision In Go language, integer types can be subdivided into 10 types int ...

Posted by leebo on Sat, 05 Mar 2022 01:29:52 +0100