Go compilation principle series 4 (syntax analysis)

prefaceIn the last article, I shared how the Go compiler parses source files into tokens. This article mainly shares how the syntax parsing stage performs syntax parsing according to different tokens. In this article, you can learn the following:Go parsing overviewGo syntax parsing detailed processThe example shows the complete process of synta ...

Added by arnoldd99 on Sat, 08 Jan 2022 07:20:23 +0200

GoFrame framework: fast implementation of service end flow limiting Middleware

introduceThrough a complete example, in gogf/gf Implement [current limiting] Middleware in the framework.We will use rk-boot To start gogf/gf Microservices.rk-boot Is a framework that can start a variety of Web services through YAML. Please refer to the last chapter of this article for details rk-boot Details.Please visit the following address ...

Added by trancemission on Thu, 06 Jan 2022 12:48:55 +0200

Five postures for executing commands with os/exec in Go language

For a complete series of tutorials, see: http://golang.iswbm.comIn Golang, the libraries used to execute commands are os/exec, exec The command function returns a Cmd object. According to different requirements, the execution of the command can be divided into three casesExecute the command without getting the resultExecute the command and get ...

Added by fleymingmasc on Wed, 05 Jan 2022 22:49:58 +0200

[Go language practice] (10) Go micro micro micro service implementation simple memo | user login and registration

Write in front Implementation of simple memo based on go micro V2 version. In this chapter, we first realize the user login and registration function Go micro framework Structure diagram Simply put, the browser accesses the gateway server, finds the service and checks whether it exists. If so, it requests the service, and then re ...

Added by scotch33 on Wed, 05 Jan 2022 10:23:29 +0200

Go Language Programming Notes 17: Web Service

Go Language Programming Notes 17: Web Service Source: wallpapercave.com Through a series of articles, I introduced how to build a Web application in Go language, specifically a website. In fact, not all Web applications exist in the form of websites, and a considerable part of them are Web services. Compared with the former, the latter has ...

Added by OldWolf on Tue, 04 Jan 2022 21:39:01 +0200

GoFrame framework: Basic Auth Middleware

introduceThrough a complete example, in gogf/gf Add Basic Auth middleware to microservices.What is HTTP Basic Auth middleware? Basic Auth middleware will intercept each API request and verify the verification of Basic Auth or X-API-Key.We will use rk-boot To start gogf/gf Microservices.rk-boot Is a framework that can start a variety of Web serv ...

Added by GrizzlyBear on Tue, 04 Jan 2022 15:44:40 +0200

Read Go generic design and usage scenarios

preface2021.12. On the 14th, Go officially released Go 1.18beta1, which supports generics, which is the most significant functional change of Go language since its birth in 2007.There are three concepts at the core of generics:Type parameters for functions and typesType parameters, which can be used for generic functions and generic typesType s ...

Added by NoReason on Tue, 04 Jan 2022 11:32:46 +0200

Dark horse GO language - learning notes

Go language File entry main The left parenthesis must go together Each file must first declare the package (there must be a main package) No semicolon The guide bag must be used data type Declaration of variables = = > var a int C: = 10 automatic derivation type Multiple assignment A, B: = 10, 20 swap a, B: = B, a Anonymous variable, b, _ ...

Added by Wolfsoap on Tue, 04 Jan 2022 11:22:15 +0200

golang, how to play with mock data?

At work, many companies require efficiency and automatic testing During the actual landing process, it is found that the current service may rely on the data and interfaces of other services for unit testing and automated testing In the process of single test or automation, the test may fail or block due to other service reasons or environmen ...

Added by klapy on Tue, 04 Jan 2022 10:01:59 +0200

10 ways to read files in Go

There are many ways to read and write file contents in Go, most of which are advanced encapsulation based on syscall or os library. Different libraries are applicable to different scenarios. In order to prevent novices from cutting corners here, I took some time to sort out these contents. This is the previous article. First introduce the 10 me ...

Added by Codein on Tue, 04 Jan 2022 05:46:33 +0200