Tag:Go language
-
Mutex and rwmutex for concurrent programming in go language
catalogue 1、 Mutex 1. Introduction to mutex 2. Mutex usage example 2、 Read / write lock rwmutex 1. Rwmutex introduction 2. Rwmutex usage example In concurrent programming, multipleGoroutineRace conditions may occur when accessing the same memory resource. We need to use appropriate synchronization operations in the critical area to avoid race conditions. Go language provides […]
-
Characteristics of go language different from other languages
catalogue 1. Go always includes binaries in the build 2. There are no managed services for go 3. Go is called by value 4. ‘defer’ keyword 5. Go adopts the best features of functional programming 6. Go has an implicit interface 7. Error handling 8. Concurrency 9. Go standard library preface: With the development of […]
-
Go language interface details
catalogue 1. Purpose of interface 2. Type assertion 3. Type selection 4. Empty interface 5. Anonymous empty interface 6. Implement multiple interfaces 7. Interface nesting 8. Interface zero value 9. The difference between make and new summary An interface is a collection of methods (canonical behavior) In the field of object-oriented, interfaces are generally defined […]
-
Installation and use of vs Code in go language integrated development environment
catalogue Go languageIntegrated development environmentofVS CodeInstallation and use Download and install Install Chinese Simplified plug-in Install go development extension Change editor theme Install go language development kit Configure vscode to enable automatic saving Configure code snippet shortcuts Installation and use of vs Code in go language integrated development environment Vs code is an open […]
-
Structure and method of go language
catalogue 1、 Structure 1. Definition and use of structure 2. Define and assign initial value 3. Anonymous structure (only used once, no name) 4. Zero value of structure 5. Pointer to structure 6. Anonymous field (field has no name, only type) 7. Nested structure (nested structure in structure) 8. Field promotion 9. Structural equality 2、 […]
-
Go uses GoLand’s go build configuration
When writing go code, Golan needs to configure the compilation environment. On the side of running, first edit configurations, enter it, click the + sign, select go build, and then configure it before generating the compiled executable exe. Here are several configuration methods: Runkind: there are three options a. Is directory, which means that it […]
-
The array and slicing of go language are introduced in detail
catalogue 1、 Array 1. Definition of array 2. Array assignment 3. Define and initialize 4. The size of the array is part of the type 5. Array is a value type 6. Array length len() the array length has been fixed in the definition stage 7. Array loop 8. Multidimensional array 9. Array definition and […]
-
Complete centos7 in 30 minutes 6. Latest production environment configuration (git2.35.1 Python 3.10.2 golang1.18 docker nginx)
0. Server preparation & target Before that, the server mainly uses Ubuntu LTS, and the RH system has not been tried. It happens to be tested with an Alibaba cloud server that is about to expire. After running for 2 months to test the stability, take notes and install another one, it will be faster […]
-
Fo cycle and conditional judgment of go language
catalogue 1、 For loop 1. Basic use 2. Omit the first part 3. Omit the first and third parts (this is a while loop) for condition {loop body content} 4. Dead cycle 5. Open multi process demonstration 6、break 2、 Switch statement 1. Basic use 2. No match by default 3. Multiple expression judgment 4. Switch […]
-
Goroutine of go language and channel exception handling
catalogue 1、 Goroutine 1. Start a goroutine 2. GMP model of go language 2、 Channel 1. Deadlock 2. Unidirectional channel 3. For cyclic channel 4. Buffer channel 5、WaitGroup 6、Select 7、Mutex 3、 Exception handling 1、 Goroutine Go A coroutine can be seen as a lightweight thread,Go Advantages of coroutines over threads: Goroutine Lower cost, size only […]
-
Set go environment variable with go env command on Windows
Use the following command settings in older versions # Enable the go modules feature $env:GO111MODULE=”on” # Set the GOPROXY environment variable $env:GOPROXY=”https://goproxy.io” However, direct operation is not recommended. It is better to adopt the following methods My computer — > properties — > environment variables To set environment variables. When we use the go language […]
-
Day 004: go language variable declaration assignment
preface I mainly study java network security, but after my internship (Security Research Engineer), I found that most of the needs come from Python and go, and Java also has but few. The company is more willing to accept handsome guys who will go, so I plan to spend an hour every day to learn […]