• Go method for realizing various current limiting


    preface When developing highly concurrent systems, we may encounter too frequent interface access. In order to ensure the high availability and stability of the system, we need to limit the traffic. You may use it  Nginx  This control request may also be implemented with some popular class libraries. Current limiting is a big killer of […]

  • Analyzing the waitgroup and lock of go


    When learning go, you know that go language supports concurrency. The easiest way is to open goroutine through the go keyword. In work, the waitgroup of sync package is used. However, this is not enough. When multiple goroutines access a variable at the same time, we should also consider how to ensure that these goroutines […]

  • Go chassis, a microservice development framework of go language


    catalogue introduction framework Get configuration Configuration item form Configure runtime Hot Loads example introduction https://github.com/go-chassis/go-chassis It’s a microservice development framework, and one of the topics brought about by the microservice development framework is: when a single application is transformed into a microservice, there are a lot of configurations that need to be managed, and you […]

  • Implementation of AES symmetric encryption by golang


    AES encryption Introduction of AES symmetric encryptionAES is a symmetric cipher designed to replace des as a widely used standard. It is a block encryption standard adopted by the federal government of the United States. AES symmetric encryption processThe input of encryption and decryption algorithm is a 128 bit packet. These groups are described as […]

  • The use of go xorm framework


    catalogue 1、 Create database connection 2、 Operating MySQL database query Struct structure 1. Get method 2. Exist method 3. Find method 4. Join method 5. Iterate method 6. Count method 7. Rows method insert to update delete Column property definition 1、 Create database connection Xorm supports single engine and multi engine. For beginners, there is […]

  • An example of simple port scanning by go


    I defined two channels in the code, which are used for production port and limiting the number of connections. If the number of connections is not limited, it is easy to be detected by the other party or cause the server of the other party not to run normally. //Production port var port = make(chan […]

  • The method of server restart in Go program


    Go is designed as a back-end language, which is often used in back-end programs as well. The server program is the most common software product of go language. The problem I want to solve here is: how to upgrade the running server program cleanly.Objective: Don’t close existing connections: for example, we don’t want to close […]

  • How to install go language in Linux


    Go (also known as “golang”) is a programming language originally developed by Google. Since its birth, it has several design principles: simplicity, safety and speed. The go language distribution has a variety of debugging, testing, tuning, and code review tools. Nowadays, go language and its tool chain are available in the basic repository of most […]

  • Using go language to build a Web Application Tutorial


    1.Abstract In the process of learning web development, we will encounter many difficulties, so I wrote a similar review article. As a roadmap, starting from the index of web development elements, this paper introduces the learning process and example code of golang development. In the description, the code is mostly used to describe the use […]

  • Using go language to simulate Python generator


    def demo_input_and_output(): input = yield ‘what is the input?’ yield ‘input is: %s’ % input gen = demo_input_and_output() print(gen.next()) print(gen.send(42)) This code demonstrates the functions of Python generator. You can see that yield does two operations at the same time, one is to send data “waht is the input”, and the other is to receive […]

  • Summary of string search method in go language


    1. Func contains (s, substr string) bool this function is to find out whether a character exists in the string. If it exists, it returns true Copy codeThe code is as follows: import (  “fmt”  “strings” ) func main() {  fmt.Println(strings.Contains(“widuu”, “wi”)) //true  fmt.Println(strings.Contains(“wi”, “widuu”)) //false } 2. Func containsany (s, chars string) bool this […]

  • Summary of string cutting method in go programming


    1. Func fields (s string) [] string. This function is used to divide a string according to 1: n spaces, and finally returnsSlice of [] string Copy codeThe code is as follows: import (  “fmt”  “strings” ) func main() {  fmt.Println(strings.Fields(“hello widuu golang”)) //out  [hello widuu golang] } 2. Func fieldsfunc (s string, f func […]