The cache is well designed, and the service will not fail

This article is modified from the live broadcast content of Go zero in the fourth issue of "Go open source theory". The video content is long and divided into two parts. The content of this article has been deleted and reconstructed. Hello, I'm glad to come to "GO open source theory" to share with you some stories, design i ...

Posted by vikramjeet.singla on Mon, 25 Apr 2022 08:00:11 +0300

The method and principle of go micro using Consul for service discovery

Go micro V4 uses mdns for service discovery by default. However, it also supports the use of other service discovery middleware, because Consul has been used for service discovery for many years. In order to facilitate the integration with other services, Consul was selected. This article will introduce the method of go micro using consult for ...

Posted by woozy on Mon, 25 Apr 2022 05:03:56 +0300

Data structure binary tree entry Go language implementation

Data structure binary tree entry Go language implementation We have been talking about one-to-one linear structure before, but in reality, there are still many one to many situations to deal with, so we need to study this one to many data structure - "tree" and consider its various characteristics to solve the relevant problems ...

Posted by tkmk on Sun, 24 Apr 2022 21:36:35 +0300

Go concurrency and channel

1.Go concurrency Go language supports concurrency. We only need to open goroutine through the go keyword. Goroutine is a lightweight thread, and the scheduling of goroutine is managed by the Golang runtime. goroutine syntax format: go Function name( parameter list ) Go allows you to use the go statement to start a new runtime threa ...

Posted by cfemocha on Sat, 23 Apr 2022 10:01:14 +0300

Solve the communication problem between go micro and other gRPC frameworks

In the previous article, we introduced the ways to develop gRPC applications using gRPC official plug-in and go micro plug-in respectively, which can work normally. However, when the two are mixed, mutual access becomes a problem. For example, when the gRPC client generated by the go micro plug-in accesses the server created based on the gRPC ...

Posted by stndrdsnz on Fri, 22 Apr 2022 02:43:48 +0300

go etcd service discovery

I etcd introduction Etcd is a distributed key value pair storage system, which is developed by coreos. Internally, etcd uses the {raft protocol as the consistency algorithm to store key data reliably and quickly and provide access. Reliable distributed cooperation is realized through distributed locks, leader elections and write barriers. Etcd ...

Posted by awpti on Thu, 21 Apr 2022 12:34:25 +0300

Go language file operation

@ introduction Computer files are data sets stored on external media (hard disk). Files are divided into text files and binary files 1. Open and close files os. The File open () method and the File close() method can get an example of File open and close close() frees up memory space Example: package main import ( "fmt" "os" ) func main( ...

Posted by kingman65 on Thu, 21 Apr 2022 08:05:45 +0300

Basis of Golang: use and basic implementation of underlying concurrency primitive Mutex RWMutex Cond WaitGroup Once

Last Common usage scenarios of native concurrent goroutine channel and select The concurrency mode based on CSP model is introduced. In addition to CSP, Go also provides some lower level synchronization API s through the sync package and atomic package, which are generally used in scenarios with high performance requirements. sync. The ...

Posted by fonecave on Wed, 20 Apr 2022 19:26:09 +0300

array, slice and append in Go

Arrays, slices (and strings): The mechanics of 'append' - go.dev When we learn arrays in a new programming language, we often need to consider the following: Variable length or fixed length? Is length part of the array data structure? What about multidimensional arrays? What does an empty array mean? The answer to these questions determines w ...

Posted by F1Fan on Tue, 19 Apr 2022 20:37:15 +0300

go language -----30-----token mechanism, WeChat official account signature verification method, XML parsing, CDATA parsing, exchange protocol, receive message protocol, passive reply message protocol, regular expression

A token mechanism for signature verification of WeChat official account 1. Token mechanism The token mechanism is to use a token (usually a string, with no special limit on the length, generally 10 bytes or 16 bytes), and then generate a signature according to a certain algorithm, and then the two sides of the connection judge through this si ...

Posted by venradio on Tue, 19 Apr 2022 16:50:30 +0300