Go Language Foundation - Goroutine - Thread Security in Shared Memory

Goroutines are lighter threads Threads are more efficient than in Java Co operative grammar go func() { //... }() Once the code in the main goroutine is executed, the current Go program will be terminated, regardless of whether other goroutines are already running. Let the master goroutine wait for other goroutines: for i := 0; i < 10; i+ ...

Added by andriy on Thu, 03 Oct 2019 05:43:28 +0300

GO Language Function Programming-Closure

GO Language Function Programming-Closure concept GO function closure Functional Programming for Fibonacci Sequences concept The main support of go language for function programming is mainly embodied in closure functions. Functions are first-class citizens: parameters, variables, and return val ...

Added by dmonares on Tue, 01 Oct 2019 12:16:20 +0300

[Series] - go-gin-api routing Middleware - Jaeger link tracking

Summary Firstly, the project overview is synchronized: Last article shared, Routing Middleware - Jaeger Link Tracking (theoretical article), this article we will continue to share: Routing Middleware - Jaeger Link Tracking (practical article). This article, indeed, has kept you waiting for a long time, mainly because there are some technical p ...

Added by drakal30 on Sat, 28 Sep 2019 17:21:16 +0300

Go Night Reading-IPFS Preview

IPFS itself does not use many new technologies, most of which are existing technologies and ideas, but it cannot be said that there is no innovation, similar to Bitcoin. dht Ideas: KadDHT's node addressing and content addressing are isomorphic. On the basis of KAD calculating logical distance based on XOR, the specific physical distance such as ...

Added by phence on Mon, 16 Sep 2019 06:16:49 +0300

Service Computing 02 - Installing go Language Development Environment

Install golang Use terminal command to install golang $ sudo yum install golang You can view the installed version and installation directory $ rpm -ql golang |more $ go version You can see that the golang language has been installed in th ...

Added by Elarion on Sun, 15 Sep 2019 16:11:56 +0300

[Golang] Talk about Gos libraries that handle command line parameters and configuration files

Preface You should have been writing Go recently, so you won't have to work with some command line parameters and configuration files.Although the native flag libraries for Go are easier to use than other languages in dealing with command line parameters, there are many useful libraries in the Go community.This article mainly introduces you to ...

Added by estan on Thu, 12 Sep 2019 20:04:26 +0300

How does Go implement protobuf encoding and decoding: principle

Links to the original text: https://mp.weixin.qq.com/s/O8... This is a companion article to analyze how Go implements protobuf encoding and decoding: How to Realize the Coding and Decoding of protobuf by Go (1): Principle How Go implements protobuf encoding and decoding (2): source code This edition is the first one. Introduction to Protocol ...

Added by danharibo on Mon, 09 Sep 2019 16:14:10 +0300

Deeply Understanding the Principles of go-channel and select

Two of the most attractive things about Go, besides goroutine, that is, channel, I've been wondering how select ion actually works. As in my previous article, some irrelevant code is omitted directly 1. Overview of structure 1.1. hchan This is the structure of channel. type hchan struct { qcount uint // Total data in queues da ...

Added by coco777 on Thu, 05 Sep 2019 05:06:15 +0300

A CAS Operational Use Scenario for Go

About a year ago, there was such a problem:There are N routines executed concurrently in the program, which will write data to a channel with size n. The N routines have high concurrency and load, so they don't want to be stuck when writing data, so they use this code. if len(c) < n { c <- something // Write in } The original meaning ...

Added by peeps on Tue, 03 Sep 2019 15:08:57 +0300

Special features of Go map

Zero Value Characteristic Some operations of uninitialized map s are legal: var testMap map[int]int size := len(testMap) // size is 0 _, present := testMap[0] // present is false non := testMap[123] // non is 0, won't case panic testMap[1] = non // panic: assignment to entry in nil map Only write operations ...

Added by IceDragon on Tue, 03 Sep 2019 12:13:27 +0300