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

Go language structure linked list

@ 1. what is a linked list Linked list is a non continuous and non sequential storage structure on the physical storage unit. The logical order of data elements is realized through the pointer link order in the linked list. The linked list is composed of a series of nodes (each element in the linked list is called a node), which can be gen ...

Posted by Strikebf on Tue, 19 Apr 2022 07:24:16 +0300

Go ini of golang operation ini package

Official website: ini.unknwon.io/docs github:https://github.com/go-ini/ini   Ini is a commonly used configuration file format on windows. The Windows version of MySQL uses ini format to store configuration. go-ini It is a third-party library used to operate ini files in Go language. This article introduces the use of go ini library. Quick use ...

Posted by spelman07 on Tue, 19 Apr 2022 05:47:20 +0300

Go concurrent programming series: mutex lock, read-write lock, conditional variable, Waitgroup, Once, temporary object Pool and atomic operation

Contents of this series of articles Expand / collapse Go concurrent programming series (I) Pipe pipeline for multi process programming and process synchronizationGo concurrent programming series (II) Signal semaphores for multi process programming and process synchronizationGo concurrent programming series (3) multi ...

Posted by s2j1j1b0 on Tue, 19 Apr 2022 03:17:40 +0300

Go language channel

It is meaningless for functions to execute concurrently only when data is exchanged between functions. The concurrency model of go language is csp model, which advocates sharing memory instead of sharing memory. Sharing memory is easy to cause competition in different goroutines. In order to ensure the correctness of data exchange, Memory must ...

Posted by Muncey on Mon, 18 Apr 2022 18:21:45 +0300

Go entry series interface -- type assertion

Contents of this series of articles Expand / collapse Go introduction series (I) getting to know go language for the first timeIntroduction to Go series (II) introduction and scope of variables, pointers and data typesIntroduction to Go series (III) basic types - integer, floating point, Boolean and stringGo entry s ...

Posted by Elemen7s on Mon, 18 Apr 2022 18:11:04 +0300