2, GO programming mode: error handling
Error handling has always been a problem that programming must face. If error handling is done well, the stability of the code will be very good. Different languages have different ways of processing. Go language is the same. In this article, let's discuss the error sources of go language, especially the crazy if err= nil .
In the formal discu ...
Added by meepokman on Sun, 06 Feb 2022 20:25:20 +0200
3, GO programming mode: FUNCTIONAL OPTIONS
In this article, we will discuss the programming mode of Functional Options. This is an application case of functional programming with good programming skills. It is the most popular programming mode in Go language at present. However, before we formally discuss this model, we need to see what kind of problems to solve.
Configuration options p ...
Added by ih8telepathy.cm on Sun, 06 Feb 2022 20:18:17 +0200
(gopher) learn nothing ebpf
preface
I believe there are still many people who don't know what ebpf is or where to start. However, it seems that it is becoming a de facto standard for the technical means of cloud native development performance optimization. In particular, ebpf has great advantages in container network performance and security. Almost all cloud manufac ...
Added by jubripley on Sat, 05 Feb 2022 12:10:22 +0200
Go component learning - channel (concurrency)
Introduction:
Recently, while learning about the concurrency channel module of go language, I saw some examples in ardan labs to promote the understanding of some principles and uses of channel
1, Definition of channel
Channels allow goroutines to communicate with each other through the use of signaling semantics. Channels accomplish ...
Added by dabbott on Fri, 04 Feb 2022 05:02:08 +0200
Go Context explanation of the ultimate no doubt
1. What is Context
Go 1.7 standard library introduces Context, which is called Context in Chinese. It is an interface used to transfer deadline, cancellation signal and request related values across API s and processes.
context.Context It is defined as follows:
type Context interface {
Deadline() (deadline time.Time, ok bool)
Done() &l ...
Added by blueguitar on Thu, 03 Feb 2022 21:53:22 +0200
Concurrent programming in Go language
Concurrency in Go language refers to the ability to make a function run independently of other functions. When a function is created as a coroutine, the Go language will treat it as an independent unit of work, which will be scheduled to be executed on the available logic processor.
Fundamentals of concurrent programming
1. Concurrency and pa ...
Added by polybiosis on Thu, 03 Feb 2022 21:15:46 +0200
Golang - Object Oriented Inheritance (Anonymous Field), Pointer Type Anonymous Field, Multiple Inheritance
Object-oriented:
Process-oriented: A process-centric programming idea that emphasizes that steps, processes, and each step is self-fulfillingObject-oriented: An object-centric programming idea that emphasizes the removal of steps, processes, and specific functions through the command of objects
Summary: If you want to eat, do it yourself ...
Added by richardbotw on Thu, 03 Feb 2022 19:37:46 +0200
Golang office automation -- manage files and folders automatically -- read and write files
Automated management of files and folders
Read and write files
read file
Using ioutil Readfile reads directly from the file into [] byte
Package name: io/ioutil Prototype: func ReadFile(filename string) ([]byte, error) Function: ReadFile reads data from the file specified by filename and returns the contents of the file. The err returned by ...
Added by lancet2003 on Thu, 03 Feb 2022 16:17:22 +0200
Golang office automation -- automatic management of files and folders -- output files and folders
Automated management of files and folders
Output files and folders
Gets the root path of the current working directory
Package name: os Prototype: func Getwd()(pwd string, err error) Function: get the current file path Return: string of current file path and an err message Example:
package main
import (
"fmt"
"os"
)
func main() {
...
Added by sparq on Thu, 03 Feb 2022 03:14:46 +0200
bgo: an extensible go program building tool
bgo v0.3.0+prefaceWe are already bgo: make it easier to build go programs The basic capabilities of bgo are introduced in.After several days of iteration, I initially felt that it was relatively stable, so I issued version 0.3.0 as a cut before the Spring Festival.The new version is availableAfter the festival, thanks to cmdr Upgrade of the ori ...
Added by kenrbnsn on Wed, 02 Feb 2022 17:28:56 +0200