Category : Back end

Official website:https://www.swoft.org/ Source code interpretation:http://naotu.baidu.com/file/8 … Extra, extra, extra,Welcome, star, our development team has set a small goal of “star 1000+ getting together offline” The yii/laravel framework in PHP is very “heavy.”HeavyNot specific firstPerformanceAt the level, it is mainly the design idea of the framework and the service of framework integration, which enables the framework ..

Read more

HTTPRespond to common status codes Blog link:Aspects of Network Knowledge Status code describe 100-199 Successful receipt of the request requires the client to continue submitting the next request to complete the entire process. 200-299 Successfully received the request and completed the whole processing process. Commonly used200 300-399 In order to complete the request, the requirements ..

Read more

premise 1. docker empty image (or similar environment) 2. Used in Go applicationsloc, _ := time.LoadLocation(“Asia/Chongqing”) Problem $ go run ./xxx panic: time:missing Location in call to Time.In Reason The location information of time is extracted from the local file system. Most systems support it, but it still depends on the current system. Specific configuration ..

Read more

Original address:In-depth understanding of gosice What is it? In Go, Slice is a special type abstracted from Array. In order to better understand Slice, the first step is to understand Array. After a deep understanding of the difference between Slice and Array, we can better explore the bottom layer usage Array func main() { nums ..

Read more

In the last article“a deeper understanding of gosice”, you will find that its underlying data structure uses theunsafe.Pointer. Therefore, I want to introduce some related knowledge again. Original address:A little unsafe but a little brighter Preface When everyone learned Go, they must have learned the knowledge point “Go pointer does not support pointer operation and ..

Read more

Original address:Proper Memory Alignment in Go Problem type Part1 struct { a bool b int32 c int8 d int64 e byte } Before starting, I hope you can calculate itPart1What is the total size? func main() { fmt.Printf(“bool size: %d\n”, unsafe.Sizeof(bool(true))) fmt.Printf(“int32 size: %d\n”, unsafe.Sizeof(int32(0))) fmt.Printf(“int8 size: %d\n”, unsafe.Sizeof(int8(0))) fmt.Printf(“int64 size: %d\n”, unsafe.Sizeof(int64(0))) fmt.Printf(“byte size: ..

Read more

Original address:How did goslip get its maximum capacity? Preface In “Understanding Go Slice in Depth”, we mentioned the processing logic of “obtaining the maximum capacity size that can be applied according to its type size”. Today, we will go deeper into what the bottom layer has done and what knowledge points are involved. The corresponding ..

Read more

Original address:Let’s control the concurrent number of Goroutine. Problem func main() { userCount := math.MaxInt64 for i := 0; i < userCount; i++ { go func(i int) { // 做一些各种各样的业务逻辑处理 fmt.Printf(“go func: %d\n”, i) time.Sleep(time.Second) }(i) } } Here, supposeuserCountIt is an externally passed-in parameter (unpredictable, possibly with a very large value), and someone will ..

Read more

Original address:For-loop and json.Unmarshal performance analysis summary Preface In the project, it is often encountered the data processing scene of cyclic exchange assignment, especially RPC. The data exchange format needs to be converted to Protobuf, and assignment is inevitable. There are generally the following methods: for for range json.Marshal/Unmarshal At this time, we are facing ..

Read more