Lexical Analysis and Parsing Part Two of Go Translation

Author: Adam Presley | Address: https://adampresley.github.io... Translator's Preface This article is about the implementation of lexical devices. If you encounter difficulties in reading, it is recommended to refer to the source code. The code snippets in this article are for the purpose of introducing ideas. How to parse will be introduced in ...

Posted by receiver on Wed, 31 Jul 2019 19:20:36 -0700

Go Crawler HTTP Request QuickStart

A few days ago, I talked about how to imitate learning on the topic of "knowing your thoughts". I gave an example of how to imitate Pyhton's requests through net/http client. But it hasn't been practiced. Is an idea really only an idea? Of course not, so I decided to suspend GO notes for a week to practice my ideas. There are some new ...

Posted by Orpheus13 on Sun, 28 Jul 2019 23:07:23 -0700

k8s and Admission--webhook admission

Preface Kubernetes provides three security access control measures for API access: authentication, authorization and Admission Control. Authentication solves the problem of who the user is, and authorization solves the problem of what the user can do. Admission Control is the role of resource management. Reasonable authority management can ensu ...

Posted by miccomte on Mon, 22 Jul 2019 02:29:24 -0700

Go Function Calls Stack and Register Perspectives

The main point of calling a function is to pass parameters and return values using registers and memory frame stacks.Although Go is a compiled language, there are some differences in the use of registers and stacks compared to C. Go has its own protocol and introduces statements such as defer, which makes the call process more complex.Understan ...

Posted by Tainted Kitten on Sat, 13 Jul 2019 10:50:38 -0700

bitcount optimization path

Question: Use Go to implement the bitcount function to count the number of bits set to 1 in a uint64 value. Option 1: The easiest way to think about this is to move one bit to the right each time, to check if the last bit is 1, so that after the bit-by-bit detection is completed, you can get the result. func bitCount1(n uint64)int8{ var coun ...

Posted by elite_prodigy on Sat, 29 Jun 2019 10:07:22 -0700

Gorm Source Analysis Simple query Analysis

Simple use In the previous article, we have learned how to call mysql database without using orm. In this article, we will look at Gorm's source code, starting with the simplest query statement. Of course, Gorm's functions support where conditions, foreign key group s, and so on. The general process of these functions is almost from a simple po ...

Posted by psd99 on Sat, 15 Jun 2019 12:51:44 -0700

Go 1.9 sync.Map Unveiling

This article is reproduced. Links to the original text Prior to Go 1.6, the built-in map type was partially goroutine secure, concurrent reading was not a problem, and concurrent writing might be a problem. Since go 1.6, read and write maps concurrently will cause errors. This problem exists in some well-known open source libraries, so the solu ...

Posted by chasiv on Tue, 11 Jun 2019 11:55:18 -0700

The Principle of FSM and the Realization of GO

Finite-state machine (FSM) can also be called finite-state automata. It must be able to attach to something, and the state of the thing is limited, through some trigger events, will make its state transition. Therefore, the finite state machine (FSM) is a mathematical model describing these finite states, trigger events and transition behavi ...

Posted by fmpros on Tue, 11 Jun 2019 10:43:13 -0700

Writer and Reader in Go Language

Input and outputThe Go Writer and Reader interfaces are designed to follow the input and output of Unix, and the output of one program can be the input of another program.Their capabilities are simple and pure, making it easy to write program code, and allowing our programs to do more through the concept of composition.For example, in the previ ...

Posted by zeb on Mon, 10 Jun 2019 10:24:36 -0700

CentOS environment installs zookeeper service and uses golang to implement Leader election of distributed system

I. Preparations 1. Download and install vmware, the steps are omitted. 2. Download the ios package for the CentOS system: http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Everything-1611.iso 3. Download and install Xshell 5, step omitted. 4. Download and install git, step omitted. 5.zookeeper official website: http://zookeeper ...

Posted by Canadiengland on Sun, 09 Jun 2019 14:25:53 -0700