GoLang design pattern 16 - template method pattern

Template method design pattern is a behavioral design pattern. This pattern is commonly used to define a template or algorithm model for a specific operation. Take OTP (One Time Password) as an example. There are two common one-time passwords: SMS password (SMS OTP) or email password (Email OTP). However, the processing steps for both SMS passw ...

Posted by Marino on Sun, 21 Nov 2021 20:15:09 +0100

Summary and practice of Go error handling

preface Recently, I reviewed and summarized the Go advanced training camp of geek time teacher Mao Jian. This is a course that is more inclined to engineering and principle. It covers a lot of knowledge points. Therefore, I decided to open a series to record, which is also convenient for me to summarize and review. This is the first in a serie ...

Posted by syth04 on Fri, 19 Nov 2021 16:16:35 +0100

Interview question: does Go have reference variables and reference passing?

prefaceIf you have used map and channel in Go, you will find that you can change the values of external map and channel in the function body without adding pointer marks * to map and channel in the function parameters.This will give people an illusion: are map and channel reference variables similar to C + +, and function parameters are passed ...

Posted by ohaus on Thu, 18 Nov 2021 06:40:27 +0100

kind installation and use

Tips: after the following command is installed, you will be familiar with it by trying it several timeskind installation curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64 chmod +x ./kind mv ./kind /${some-dir-in-your-PATH}/kind kubectl installation curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/st ...

Posted by apulmca2k4 on Wed, 17 Nov 2021 11:32:47 +0100

Go iota principle and source code analysis

Iota is a reserved word of the Go language and is used as a constant counter. Since iota has self increasing characteristics, the constant definition of digital growth can be simplified.iota is a magic keyword, which often makes it difficult for beginners to understand its principle and usage.This paper will analyze iota keywords from the aspec ...

Posted by lifeson2112 on Wed, 17 Nov 2021 05:50:42 +0100

[docker series] docker learning IV. principles related to mirroring

[docker series] docker learning IV. principles related to image What is mirroring? Mirroring is a lightweight, executable, stand-alone software package. Image is used to package the running environment of software and software developed based on the running environment. It contains all the contents required to run some software, such as code, ...

Posted by cli_man on Fri, 12 Nov 2021 19:43:10 +0100

JWT authentication and golang implementation of JWT demo

JWT=JSON Web Token is a popular distributed authentication scheme.Certification schemeThe traditional Cookie/Session authentication scheme is commonly used. The authentication process is as follows:The user sends username+password to the server;After authentication, the server stores the login information of the user, such as userId/role/loginT ...

Posted by Woodburn2006 on Sat, 06 Nov 2021 20:27:13 +0100

[algorithm learning] sword finger Offer II 042. Number of recent requests (Java / C / C + + / Python / go / trust)

Thank you very much for reading this article~ Welcome[ ๐Ÿ‘ [like][ โญ Collection][ ๐Ÿ“ [comments]~ It's not hard to give up, but it must be cool to insist~ I hope all of us can make a little progress every day~ This paper consists of The white hat of the second leader https://le-yi.blog.csdn.net/ Blog originality~ Sword finger Offer II ...

Posted by omegared on Tue, 02 Nov 2021 16:02:57 +0100

How to access the host from within the docker container

Recently, I started envoy proxy, pulled the envoyproxy/envoy:latest image, and conducted a local test. However, when the proxy failed, I recorded the whole process. Configure agent Refer to envoyproxy official Front end agent sample configuration As a blueprint, it has changed to its own configuration. The contents are as follows: static_res ...

Posted by craigerjs on Tue, 02 Nov 2021 08:05:43 +0100

Go package, Init function and execution sequence

1, Package concept The package of Go language is organized in the form of directory tree. Generally, the name of the package is the name of the directory where its source file is located. This is like generating a subdirectory in an existing package. When writing code, all you need to do to import the package is to provide the relative path of ...

Posted by alexander.s on Sun, 31 Oct 2021 11:36:19 +0100