Golang learning notes - process control

Elif else structure The left brace {after the keyword if and else must be on the same line as the keyword. If you use the else if structure, the right brace} of the previous code block must be on the same line as the else if keyword. Both of these rules are enforced by the compiler. // Illegal code if condition{ } else { // invalid } In ...

Posted by rapmonkey on Fri, 11 Feb 2022 16:25:25 +0100

Microservices have everything from code to k8s deployment (III. authentication)

We will use a series to explain the complete practice of microservices from requirements to online, from code to k8s deployment, from logging to monitoring. The whole project uses the micro services developed by go zero, which basically includes go zero and some middleware developed by relevant go zero authors. The technology stack used is bas ...

Posted by Az_Critter on Fri, 11 Feb 2022 11:29:05 +0100

Go bufio.Reader structure + detailed source code II

You have to work very hard to look effortless! WeChat search official account [Coding road], together with From Zero To Hero! preface Last article Go bufio.Reader structure + detailed source code I , we introduced bufio The basic structure and operation principle of reader, and introduces the following important methods: Reset: reset the ...

Posted by mulysa on Fri, 11 Feb 2022 08:27:43 +0100

Go language operation database and its general operation

Go MySQL operation Install: go get - u GitHub com/go-sql-driver/mysql The operation database driver of GO language supports connection pool and is a standard library for concurrency security. There is no specific implementation, but lists the specific contents of some third-party libraries that need to be implemented //Successfully connected t ...

Posted by DssTrainer on Fri, 11 Feb 2022 02:18:12 +0100

Operator-SDK: Custom CRD for Node request information collection

Operator-SDK: Custom CRD for Node request information collection A demo for information collection, which writes a Controller custom CRD to implement Node's request information collection. The primary purpose is to obtain CPU and memory usage. Part of the code refers to the source implementation of describe in the kubectl command. Cluster ...

Posted by amit on Fri, 11 Feb 2022 01:09:07 +0100

for & range performance comparison

origin Recently used Go brush LeetCodeFirst question, sum of two numbers. When solving the problem, I use traversal to solve. I accidentally find that the beats of for and range are inconsistent. In the spirit of in-depth research (I don't know anything), I want to compare the performance of the two.Article reference Geek rabbit The original o ...

Posted by lip9000 on Thu, 10 Feb 2022 08:56:34 +0100

golang learning notes Part 2: 9 Arrays and slices

golang learning notes Part 2: 9 Arrays and slices 18. Array 1) Array definition: store multiple data of the same type. In go language, array is the value type var array name [array size] data type var a [5]int var b [3]int = [3]int{1,2,3} var c = [3]int{1,2,3} var d = [...] int {1,2,3} / /... Represents the traversal of the array for the syst ...

Posted by nec9716 on Wed, 09 Feb 2022 19:12:01 +0100

Microservices have everything from code to k8s deployment series (II. Gateway)

We will use a series to explain the complete practice of microservices from requirements to online, from code to k8s deployment, from logging to monitoring. The whole project uses the micro services developed by go zero, which basically includes go zero and some middleware developed by relevant go zero authors. The technology stack used is basi ...

Posted by pedromau on Wed, 09 Feb 2022 17:14:31 +0100

gorilla/mux framework (RK boot): add Prometheus monitoring Middleware

introduce Through a complete example, based on gorilla/mux Prometheus monitoring middleware is added to the micro service of the framework. What is Prometheus monitoring interceptor / Middleware? The monitoring interceptor will record Prometheus Metrics for each API request. We will use rk-boot To start gorilla/mux Microservices. P ...

Posted by infini on Wed, 09 Feb 2022 10:23:11 +0100

Session cookies, some authentication mechanisms of gin framework

gin.Cookie() use The following small example can use postman to request. As long as the service is started, it is mainly the cookie function to get the value of the request header and the SetCookie function to set the value of the cookie func main() { r := gin.Default() r.Get("/cookie", handler.MyHandler) r.Run(":8080") } func MyH ...

Posted by ColinP on Wed, 09 Feb 2022 08:16:51 +0100