Slice expansion strategy after Golang version 1.18

Directory Problem export sizeclasses.go file Expansion strategy caused by single element insertion Capacity less than 256 Capacity greater than 256 Inserting elements in batches leads to capacity expansion Summarize Question export I have been learning Golang recently and am very interested in the expansion strategy of slice. First look at the following piece of code […]

[Go]–Golang handles HTTP/HTTPS requests

1. Supplementary HTTP knowledge points http operation method HTTP defines different methods for interacting with the server. There are four basic methods, namely GET, POST, PUT, and DELETE. The full name of URL is resource descriptor. We can think of it this way: a URL address is used to describe a resource on the network, […]

Recommend a flexible and high-performance logging library in golang

1. Standard log library log In daily development, logging is an essential function. Although sometimes you can use the fmt library to output some information, it is not flexible enough. The Go standard library provides a logging library log. 1. Quick use Log is provided by the Go standard library and does not require additional […]

Golang WebSocket creates a separate session

Introduction In Internet applications, real-time communication is a very important feature. WebSocket is a TCP-based protocol that allows bidirectional communication between clients and servers. Golang is a high-performance programming language that provides native support for WebSocket, making it very simple to create WebSocket sessions in Golang. This article will introduce how to use Golang to […]

Blockchain development using Golang Web3 library

Introduction Blockchain, as a distributed ledger technology, has achieved tremendous development in recent years. Golang, as an efficient and highly concurrency programming language, is widely used in blockchain development. In Golang, we can use the Web3 library to interact with Ethereum or other blockchain networks. The Web3 library is a library of tools for interacting […]

Implementation principle of golang smooth restart library overseer

The overseer mainly completes three functions: 1. Lossless closing of the connection, 2. Smooth restart of the connection, 3. Automatic restart of file changes. Let’s talk about it in turn: 1. Lossless closing of the connection Golang’s official net package does not support lossless closing of connections. When the main listening coroutine exits, it will […]

Linux, windows command line output control instructions, colored information, multi-line refresh, progress bar effect, golang

1. Colored information linux Color and pattern number // foreground background color //—————————————— // 30 40 black // 31 41 red // 32 42 green // 33 43 yellow // 34 44 blue // 35 45 purple // 36 46 cyan blue // 37 47 white // //Mode code meaning //———————— // 0 terminal default […]

The ultimate solution to buried logs–Golang+Gin+Sarama VS Java+SpringWebFlux+ReactorKafka

The ultimate solution to buried logs–Golang + Gin + Sarama VS Java + SpringWebFlux + ReactorKafka I have written several articles before about OpenResty + lua-kafka-client writing buried data to Kafka, as follows: Lua writes Nginx request data to Kafka – buried log solution Python scheduled task executes shell script to cut Nginx logs – […]