The difference and implementation principle of make and new keywords in Go language

The difference and implementation principle of make and new keywords in Go language new and make are two built-in functions, which are mainly used to create and allocate types of memory. When we define variables, we may feel a little confused. We don't know which function should be used to declare variables. In fact, their rule is very simple. ...

Added by joplinfan on Thu, 13 Jan 2022 13:07:14 +0200

[algorithm] 2103 Ring and rod (Java / C / C + + / Python / go / trust)

1281. Difference between bit product sum of integers: There are n rings in total, and the color of the ring can be one of red, green and blue. These rings are distributed on 10 rods numbered 0 to 9. Give you a string rings with a length of 2n to represent the distribution of these n rings on the rod. Every two characters in rings form a ...

Added by geo3d on Thu, 13 Jan 2022 05:32:22 +0200

go dns parsing process and tuning

background Through zipkin, some students found that dns parsing occasionally took 40ms (expected to be within 1ms), and speculated that it was related to the alpine image. The first reaction is unlikely to be the problem of the alpine image (the alpine image is used so frequently, and if there is a problem, it should have been fixed long ago). ...

Added by supratwinturbo on Wed, 12 Jan 2022 14:15:42 +0200

Go language programming specification recommendations

The first part introduces the coding specifications of some common problems in the development process, and the second part mainly introduces the better writing methods of some common problems, as shown in the figure below. 1. Guiding principles 1.1 pointer to interface There is little need for pointers to interface types. The interf ...

Added by bben95 on Wed, 12 Jan 2022 13:18:52 +0200

Go practice | implementation of concurrent execution flow based on directed acyclic graph

Hello, I'm a fisherman from Go school. Today, let's talk about the implementation of workflow based on directed acyclic graph01 workflow overviewWorkflow is a model that organizes and executes the work in the workflow according to certain rules. For example, overtime application and leave application in common administrative systems; The proble ...

Added by Tremor on Tue, 11 Jan 2022 17:03:31 +0200

Golang arrays and slices

1, ArrayLike most other languages, the array of Go language is also a fixed length sequence with the same element type.(1) Array creation.There are three ways to create arrays: [length]Type, [n] type {value1, Value2,..., valuen}, [...] Type {value1, Value2,..., valuen} is as follows:func test5() { var iarray1 [5]int32 var iarray2 [5]int ...

Added by kaspari22 on Mon, 10 Jan 2022 09:21:09 +0200

M1 Mac builds Golang development environment from scratch

1, Installing and configuring iTerm2 1. View the terminal Check whether the terminal is Zsh. The M1 version of Mac uses Zsh as the shell by default Open the built-in terminal software to check whether it is zsh. If not, please set and install it yourself. 2. Install iTerm2 Go to the official website of iTerm2 and download it https://iterm2. ...

Added by ivory_kitten on Mon, 10 Jan 2022 03:03:08 +0200

golang practice - digital signature and authentication

I Digital signature Imagine a scenario: Alice sends Bob a message (I'll invite you to dinner tomorrow). The message is encrypted with Bob's public key (public key encryption can ensure that only Bob can decrypt the message with his own private key after it is intercepted). However, since Bob's public key can be owned by others, Tom can also en ...

Added by ann on Sun, 09 Jan 2022 09:00:48 +0200

Go concurrent scheduling advanced - circular scheduling, not the dead loop you understand

Go concurrent scheduling advanced - [gongzong No.: stack future] original text 3. Cyclic scheduling All GMP initialization has been completed. It's time to start the runtime scheduler. We already know that when all the preparations are completed, the last call to start execution is runtime Mstart. Main functions of mstart: Determine the ...

Added by Azu on Sun, 09 Jan 2022 07:02:47 +0200

Use of golang json Library

Basic introduction to json Library Objects are passed through byte arrays in the network. In daily front and back-end interaction, they may be used in many forms, such as json, xml, pb, etc. This article mainly introduces the daily usage of json related libraries in golang language Serializable and Deserialize Serialization refers to th ...

Added by jcinsov on Sun, 09 Jan 2022 06:59:15 +0200