57 common mistakes in Golang development
1. A single line of left curly braces is not allowed2. Unused variables are not allowed3. Unused import is not allowed (import with package name)4. Short variable declarations can only be used inside functions// myvar := 1 // error
var myvar = 1 // ok5. You cannot duplicate declarations with short variable declarations6. You cannot use shor ...
Posted by redarrow on Tue, 22 Feb 2022 06:44:21 +0100
Go custom JSON serialization
By using structure tags, adding whitespace and encapsulating response data, we have been able to add a lot of custom information to JSON responses. But what happens when you need more freedom to customize JSON when that's not enough?
To answer this question, we first need to talk about some theories of how Go handles JSON serialization. The ke ...
Posted by eojlin on Tue, 22 Feb 2022 02:12:43 +0100
Microservices have everything from code to k8s deployment (XI. Log collection)
We will use a series to explain the complete practice of microservices from requirements to online, from code to k8s deployment, from logging to monitoring.
The whole project uses the micro services developed by go zero, which basically includes go zero and some middleware developed by relevant go zero authors. The technology stack used is bas ...
Posted by AmbroseChapel on Mon, 21 Feb 2022 04:46:50 +0100
[Go] Channel of concurrent programming
1, What is channel for? For communication between goroutine s
Simply executing functions concurrently is meaningless. Functions need to exchange data between functions to reflect the significance of concurrent execution of functions.
Although shared memory can be used for data exchange, shared memory is prone to race problems in differe ...
Posted by gordonmc on Mon, 21 Feb 2022 04:19:00 +0100
[Go golang Crawler Actual] Crawl popular emoticons
background
My girlfriend complained two days ago that a big V made a video with many popular expressions. Say the big V said he was crawled directly by someone in the team. Ask me when to give her a crawl? After many days of nagging, I finally took action.
Target Site Analysis
First I found a website with popular emoticons. Let's have f ...
Posted by ehutchison on Sun, 20 Feb 2022 19:45:01 +0100
What is the difference between make and new in Go
This paper mainly introduces the use and difference between new and make in Go language. New and make are two built-in functions in Go language, which are mainly used to create allocated type memory. When we define the generated variables, we may feel a little confused. In fact, their rules are very simple. Let's illustrate their differences an ...
Posted by DaveM on Sun, 20 Feb 2022 12:31:10 +0100
This paper introduces a super convenient Go language ini configuration file parsing tool: wego/config
wego/config
introduce
wego/config is a GO language version of ini configuration file parsing tool. wego/config has the following characteristics: First prepare the app Conf configuration file:
1)Provided GetString,GetInt...as well as MustrString,MustInt...Function to facilitate the acquisition of configuration data.
2)Support through struct ...
Posted by keyser soze on Sun, 20 Feb 2022 02:37:00 +0100
Golang open source streaming media audio and video network transmission service - LAL
I Introduction to lallal is an open source live streaming media network transmission project, which is mainly composed of three parts:lalserver: streaming media forwarding server. It is similar to nginx RTMP module and other services, but supports more protocols and provides richer functions.demo: some small applications, such as push and pull ...
Posted by theperfectdrug on Sun, 20 Feb 2022 01:05:11 +0100
Go Web programming practice -- function
preface
This blog post mainly introduces the function definition of Go language and its usage.
Declaring and using functions
In Go language, the format of function declaration is as follows:
func function_name([parameter list])[return_types]{
//Function body
}
When you use the compiler for development, such as GoLand, you will find t ...
Posted by paxman356 on Sat, 19 Feb 2022 15:02:26 +0100
go language template engine, introduction to gtpl use
gtpl
Share a go language template engine written by yourself today. Convenient for template grammar analysis at very fast speed when the go language outputs HTML rendering. Compared with the go language official library html/template, the syntax of gtpl is concise, flexible and easy to use.
The ultimate goal of gtpl is to completely replace t ...
Posted by stevepatd on Fri, 18 Feb 2022 18:21:16 +0100