Go language slice advanced

Introduction: There is such a problem when learning the slicing type of go language. First, in go, the slice type variable actually stores an address, which is the address of the first element of the underlying array it references, or the address of the array. (I) Code 1: package main import "fmt" func change(a []int) { //Here is the add ...

Posted by novice4eva on Thu, 04 Nov 2021 14:04:46 -0700

Gin framework: add API logging Middleware

introduceThrough a complete example, add API logging middleware to the micro service based on Gin framework.What is log interceptor / Middleware?The log interceptor logs every API request.We will use rk-boot To start the microservices of the Gin framework.Please visit the following address for a complete tutorial: https://rkdocs.netlify.app/cni ...

Posted by allelopath on Wed, 03 Nov 2021 20:43:13 -0700

Echo framework: add API logging Middleware

introduceThrough a complete example, add API logging middleware to the micro service based on Echo framework.What is log interceptor / Middleware?The log interceptor logs every API request.We will use rk-boot To start the microservice of the Echo framework.Please visit the following address for a complete tutorial: https://rkdocs.netlify.app/cn ...

Posted by parthatel on Wed, 03 Nov 2021 15:31:37 -0700

[Golang] microservice implementation tool -- go kit is easy to understand

Go kit is a distributed development tool set, which can be used to build micro services in large organizations (businesses). It solves most common problems in distributed systems. Therefore, users can focus on business logic First of all, we should understand that go kit is not a framework. It is just a tool set. It has some toolkits to help ...

Posted by savagenoob on Wed, 03 Nov 2021 15:10:58 -0700

Debugging the destroy container on Kubernetes

TL;DR Content of this article: Describes the, functions and simple use of the destroy image How to debug against the of the destroy container Use of temporary containers (v.1.18 +) Destroy mirror The destroy container is used as the name suggests Destroy mirror A container that runs as a base image. The "destroy" im ...

Posted by asmon on Wed, 03 Nov 2021 00:07:57 -0700

Go language Bible - Chapter 5 - 5.5 function values

Chapter 5 functions Function allows us to package a statement sequence into a unit, and then call it many times from other parts of the program. The mechanism of function allows us to decompose a large work into small tasks. We have touched on functions before, and we will discuss more features of functions in this chapter 5.5 function value ...

Posted by defunct on Tue, 02 Nov 2021 18:08:14 -0700

Implementation of Leader election in k8s client go

introduce In recent years, with the increasing demand for reliable systems and infrastructure, the term "high availability" has become more and more popular. In distributed systems, high availability usually involves maximizing uptime and making the system fault-tolerant. In high availability, a common practice is to use redunda ...

Posted by Rheves on Fri, 29 Oct 2021 22:54:48 -0700

Golang reflection operation

preface What is reflection? We often use it, and it's a rotten noun. I won't introduce it in detail here In short, there is a variable of unknown type, its type can be obtained through reflection, and its properties and methods can be manipulated Reflection is generally used as a generation tool method. For example, you need a ToString method t ...

Posted by Celauran on Fri, 29 Oct 2021 06:16:16 -0700

Detailed explanation of preemption scheduling caused by Goroutine running for too long~

Original address: Detailed explanation of preemption scheduling caused by Goroutine running for too long~ This paper focuses on the following two points: Preemptive scheduling occurs. Preemptive scheduling due to long running time. sysmon system monitoring thread will periodically (10 milliseconds) preempt goroutine through retake. Look a ...

Posted by Waseem Ullah Kh on Thu, 28 Oct 2021 19:11:49 -0700

Go Basics - concurrency

Go Basics - Contents (1) Go start (2) Variable (3) Operators, process control (4) Functions (5) Container (6) Structure (7) Concurrent preface Multiple tasks can be executed at the same time. Concurrent programming has a wide meaning, including multi-threaded programming, multi process programming and distributed programming. The mea ...

Posted by tgavin on Thu, 28 Oct 2021 13:37:07 -0700