Category: Go
-
Post Views: 18 write in front Recently I tried to use the trae cn editor on Ubuntu 26.04, with the docker container to develop a Go + Gin project (go-gin-learning). The whole process stepped on some pits, but I also ran through a set of workflow that was relatively easy. This article is a complete record, I hope it can…
-
Post Views: 22 In the concurrent programming of Go language, goroutine is a lightweight thread implementation. However, if panic occurs in goroutine and is not captured, the entire program will crash. In this article, we will dive into two cases of using and not using Recover in depth through specific examples, and we will dive into how to properly handle…
-
Post Views: 18 This series of articles records the author’s experience and practical experience in learning the Go standard library. This article is from the built-in template engine of Go Html/Template And text/template Start with, take you to quickly grasp the core concepts and practical usage, and intersperse the developer perspective of PHP to Go. Introduction: From PHP Mix to…
-
Post Views: 19 problem background In Go language, when we read data from an unclosed channel, the read operation blocks if there is no data in the channel. The traditional practice is to traverse the channel until it is closed, but in actual development, we may not be able to determine when the channel should be turned off, or when…
-
Post Views: 23 In programming learning, judging prime numbers is a classic algorithm problem. When the amount of data is small, the traditional serial loop is enough to cope; but when the amount of data is expanded to hundreds of thousands or more, how to improve the computing efficiency has become the key. Based on the Go language, this paper…
-
Post Views: 36 In the concurrent programming of the Go language, the channel (channel) is the bridge connecting the goroutine. Many beginners often encounter “deadlock” errors when using unbuffered channels, or are confused about the blocking mechanism of the channel. This article will use a specific case to compare two different channel usage scenarios, and deeply analyze the blocking principle…
-
Post Views: 49 In the official tutorial of Go language, Web Crawler practice is a very classic concurrent programming case. It requires us to modify a basic recursive crawler so that it can crawl the URL in parallel, while ensuring that the same URL is not repeated. This article will take you to analyze the original code problem step by…
-
Post Views: 102 Preface In most programming languages, it is quite complex to check if two binary trees store the same sequence of values. It is usually necessary to write a recursive algorithm to traverse the two trees and then compare them by node. But in the Go language, we can use its powerful concurrent primitives and channel (channel) mechanisms…
-
Post Views: 66 In the previous Go concurrency review, I focused on the many drawbacks of ‘global variable lock synchronization’ through factorial cases, especially the core question of ‘there are still hidden dangers when adding locks and hibernation’ Question – Manually set the sleep time to accurately match the rhythm of the execution of the protocol. If the resource is…
-
Post Views: 45 In Go language concurrent programming, channel (pipe) is the core mechanism of communication between goroutines, which follows The design philosophy of communicating to share memory, rather than communicating through shared memory, fundamentally solves many hidden dangers of global variable lock synchronization. In the previous study, we understood the necessity of the channel through the factorial case. This…