Go | Function Notes

summary of details The function's formal parameter list can be multiple, and the return value list can also be multiple The data type of the formal parameter list and the return value list, which can be a value type or a reference type The name of the function follows the identifier naming convention. The first letter cannot be a number. ...

Posted by jmansa on Thu, 24 Nov 2022 12:38:42 +0300

Go Error Handling Best Practices

The most obvious difference between Go's error and Java's Exception is:Native libraries do not carry stacktraceNative library does not support WrapThis brings some troubles to program debug ging, so we will use github.com/pkg/errors to replace the native errors package to handle Error s.However, due to the high probability of not usin ...

Posted by ediehl on Mon, 21 Nov 2022 06:02:43 +0300

The use and source code analysis of microservice gateway current limiting middleware gateway integration and standard library rate limiting device

Microservice gateway (8) Current limiting middleware gateway integration and use of time/rate rate limiter and source code analysis Current limiting principle The meaning of current limit Three powerful tools for high concurrency systems: cache ​ Improve system access speed and increase processing capacity, and increase cache for correspon ...

Posted by firedrop on Thu, 20 Oct 2022 18:59:35 +0300

[3-4 Golang] GC—Scheduling and Tuning

  The basic knowledge of garbage collection has been introduced almost, but it is necessary to know that the garbage collection process requires CPU time, which may affect the scheduling of user coroutines, so garbage collection related tuning is required in some scenarios. This article mainly introduces the trigger timing of garbage ...

Posted by rvdb86 on Thu, 13 Oct 2022 06:43:38 +0300

Borrowing where variables exist, shepherds laugh with pointers, go lang 1.18 introductory refined tutorial, from Bai Ding to Hongru, go lang type pointer (Pointer) using EP05

What does the pointer mean? A pointer is a variable that stores the address of another variable in memory. A variable is a convenient placeholder for referencing a computer's memory address. A pointer variable can point to the memory address of any value and it can point to the memory address of that value. By analogy, the pointer is the c ...

Posted by ccb on Fri, 16 Sep 2022 21:52:50 +0300

Basic data types for the golang learning notes series

Basic data types In the go language, data types are used to declare functions and variables. Data types appear to divide data into data of different memory sizes. When programming, large data is needed to apply for large memory. When small data is needed, small memory is needed to make full use of space. The go language has the following dat ...

Posted by ezekiel on Sun, 11 Sep 2022 21:28:26 +0300

Golang implements word and Excel processing

Golang uses the underlying development of Windows I know from the previous blog, Python can realize Windows low-level development through pywin32 The most common are word and Excel processing, automatic printing, etc. I once said that programming language is just a tool. As long as the tool plays smoothly, everything is possible. According ...

Posted by Iconoclast on Fri, 19 Aug 2022 10:39:05 +0300

Official tutorial: Go fuzzing fuzzy test

prefaceGo 1.18 introduces fuzzy testing in the go tool chain, which can help us find bugs in the go code or inputs that may cause program crash. The official go team has also released an introductory tutorial on fuzzing on the official website to help you get started quickly.On the basis of translation, I have optimized the expression of the of ...

Posted by spighita on Sat, 06 Aug 2022 21:24:47 +0300

Write, append, read, and copy of golang files: examples of using bufio packages

Write, append, read and copy operations of golang files There is an OpenFile function under the os package of the Go language. Its prototype is as follows: func OpenFile(name string, flag int, perm FileMode) (file *File, err error) Where name is the file name of the file. If you are not running under the current path, you need to add the spe ...

Posted by teddmcload on Thu, 30 Jun 2022 16:56:27 +0300

Go language | Are you still getting the file size like this?

In a project, we may need to get the size of a file. In Golang (Go language), there are many ways to get the size of a file to see if you are still using the slowest way. Read byte method The first one is the most intuitive to think of, which is to open the file and read the file again. func main() { file,err:=os.Open("water") if err = ...

Posted by imagenesis on Wed, 25 May 2022 23:51:37 +0300