For example, several fatal scenes in Go language that cannot be recovered
Error type
error
The first is the most standard error in Go, which is actually an interface {}.
As follows:
type error interface { Error() string}
In daily engineering, we only need to create any structure and implement the error method, which can be regarded as the error error type.
As follows:
type errorString struct { s string}func (e ...
Added by OuchMedia on Mon, 03 Jan 2022 15:58:55 +0200
Go language operation Redis
Go language operation Redis
Redis is also frequently used in project development. This paper introduces the basic use of Go redis Library in Go language.
1, Redis introduction
Redis is an open source in memory database. Redis provides a variety of different types of data structures. Problems in many business scenarios can be naturally mapped to ...
Added by crinkle on Mon, 03 Jan 2022 13:35:29 +0200
gRPC Learning Notes
gRPC Learning Notes
1. Introduction to gRPC
gRPC It is a high performance, universal open source RPC framework designed by Google for mobile application development based on HTTP/2 protocol standards, based on ProtoBuf(Protocol Buffers) serialization protocol, and supports many development languages.
[External chain picture transfer fail ...
Added by nrg_alpha on Mon, 03 Jan 2022 11:02:59 +0200
[design pattern, C + +, go] creation pattern: Builder Pattern
Builder pattern
introduce
Builder Pattern uses multiple simple objects to build a complex object step by step
Definition: Separate the construction of a complex object from its representation sothat the same construction process can create different representations. (separate the construction of a complex object from its representati ...
Added by sayoko on Mon, 03 Jan 2022 10:20:18 +0200
Go function, array, pointer, structure, slice
Go function, array, pointer, structure, slice
10, Functions
1. Format:
func Function name(parameter list) return type{
}
When there are multiple return values:
func Function name(parameter list) (Return value 1 type,Return value 2 type,Return value 3 type){
}
2. Function parameters
(1) Value passing; Go language uses value passing by def ...
Added by hexguy on Mon, 03 Jan 2022 09:04:25 +0200
golang notes and documentation and go doc/godoc notes
Welcome to official account No. DailyOps
I wish you a happy 2022 new year in advance~ Original text connection golang notes and documentation and go doc/godoc notes
golang comments
Single-Line Comments
It is the most common and used annotation method, starting with / / and followed by comments.
It can be a single line or after a state ...
Added by Unknown User on Sun, 02 Jan 2022 23:49:17 +0200
Thoroughly understand Events in Kubernetes
Hello, I'm Zhang Jintao.I wrote an article before More elegant Kubernetes cluster event measurement scheme , Jaeger uses tracing to collect and display events in Kubernetes cluster. The final effect is as follows:When I wrote that article, I set up a flag to introduce the principle in detail. It's been a long time. Now it's the end of the year, ...
Added by jalperin on Sun, 02 Jan 2022 22:40:52 +0200
There is no one of the simplest service response time optimization methods
Preface - From Wan Junfeng Kevin
The average delay of the service is basically about 30ms. One of the very big prerequisites is that we make extensive use of MapReduce technology, so that even if our service calls many services, it often depends only on the duration of the slowest request.
For your existing services, you do not need to opti ...
Added by freakuency on Sun, 02 Jan 2022 19:58:37 +0200
Problems using buffer object pool (sync.Pool) (forward + summary)
sync.Pool can improve throughput in high concurrency scenarios, but improper use will lead to serious problems. Here is a detailed review of the problems encountered this time.
# preface
The problem of missing body always occurred in the test simulation environment before. After a long time of troubleshooting, the reason was finally found. Th ...
Added by A JM on Sun, 02 Jan 2022 00:41:16 +0200
go learning - Methods
1, Method
The methods in Golang act on the specified data type (that is, bind to the specified data type). Therefore, custom types can have methods, not just struct s.
2, Use of methods
package main
import "fmt"
//Define a structure
type Person struct {
Name string
}
//Binding method to structure
func (person Person) test() {
person.Nam ...
Added by genics on Sat, 01 Jan 2022 08:40:46 +0200