Understanding Gin Middleware Flow: Next(), Abort(), and the Onion Model
Gin Context Handling
// Gin context processing
func (engine *Engine) HandleContext(c *Context) {
oldIndexValue := c.index
c.reset()
engine.handleHTTPRequest(c)
c.index = oldIndexValue
}
// Route matching logic
func (engine *Engine) handleHTTPRequest(c *Context) {
httpMethod := c.Request.Method
rPath := c.Request.URL.Path
unes ...
Posted on Thu, 28 May 2026 16:40:28 +0000 by kriss37
Building a Message Queue with Redis Streams in Go
This article demonstrates how to implement a message queue using Redis Streams in Go. We will examine the core architecture, focusing on the Redis client configuraton and connection management logic.
The project is strcutured into several key components:
redis: A package for configuring and connecting to Redis, including connection pooling.
pr ...
Posted on Wed, 27 May 2026 17:24:19 +0000 by UVL
Declaring Variables in Go Programming Language
In Go, variables hold data of specific types such as integers, floating-point numbers, or booleans. Every variable must be declared before use and carries an explicit type.
Go supports several forms of variable declaration:
Explicit Type Declaration
Variables are introduced with the var keyword followed by name and type. No semicolon is require ...
Posted on Mon, 25 May 2026 22:23:49 +0000 by supermars
Implementing Thread-Safe Single-Machine Concurrent Cache
Ensuring Concurrency Safety in Cache Implementation
The second iteration phase focuses on guaranteieng thread safety for our cache implemantation while developing a core Group srtucture. This Group concept can be likened to a table in MySQL, providing namespace isolation for cached data.
A critical feature we implement is a fallback mechanism. ...
Posted on Fri, 22 May 2026 16:51:23 +0000 by sullyman
Capturing Network Traffic with Raw Sockets in Go
Capturing Network Traffic with Raw Sockets in Go
The most common library for capturing network traffic in Go is github.com/google/gopacket, which requires libpcap and therefore must be compiled with CGO enabled. To reduce environmental dependencies, we can use raw sockets to capture network traffic and then leverage gopacket's protocol parsing ...
Posted on Wed, 20 May 2026 20:31:02 +0000 by kingnutter
Understanding Pointers in Go
Pointers in Go are variables that store memory addresses of other variables. They provide a way to directly manipulate memory and pass references to values across functions.
Basic Pointer Operations
The address operator (&) obtains the memory address of a variable, while the dereference operator (*) accesses the value stored at that address ...
Posted on Wed, 20 May 2026 17:39:47 +0000 by scuba
Sorting in Go: Built-in and Custom Approaches
1. Default Sorting
Go provides built-in sorting capabilities through the sort package. The sorting operations modify the slice in place, meaning the original slice is changed directly without creating a new one.
package main
import "fmt"
import "sort"
func main() {
// Strings can be sorted using sort.Strings()
col ...
Posted on Mon, 18 May 2026 00:23:15 +0000 by cytech
Deploying and Managing a High-Performance Object Storage Server with MinIO
Comparing Distributed File Storage Solusions
When evaluating distributed storage architectures, MinIO stands out as a prominent solution. It is a high-performance object storage server built using Go, allowing it to run seamlessly across various operating systems including Windows, Linux, macOS, and FreeBSD. Its deployment is streamlined, often ...
Posted on Sat, 16 May 2026 00:38:36 +0000 by seek
Calling C/C++/Go Code Directly in Web Pages Using WebAssembly
When building a rosbag visualization tool, it was discovered that a static web frontend could parse rosbag files without any backend API requests, prompting investigation into WebAssembly as the underlying technology.
WebAssembly Basics
WebAssembly (abbreviated WASM) is a low-level, efficient binary instruction format built for browser-based ex ...
Posted on Fri, 15 May 2026 09:44:12 +0000 by skoobi
Go Concurrency Fundamentals: Goroutines, Channels, and Select Statements
Go's concurrency model is built around lightweight, independently executing functions known as goroutines. A goroutine can be thought of as a function running concurrently with other functions within the same address space. They are significantly less expensive than traditional operating system threads, making it practical to launch thousands o ...
Posted on Fri, 15 May 2026 03:20:17 +0000 by CybJunior