Skip to content
ADHDecode
  1. Home
  2. Articles
  3. Golang

Golang Articles

71 articles

Profile Go CPU and Memory Usage with pprof

The most surprising thing about Go's pprof is how little instrumentation it actually needs to give you a crystal-clear picture of your application's per.

2 min read

Find Data Races in Go with the Race Detector

The Go race detector doesn't actually find data races; it detects potential data races by observing memory access patterns.

4 min read

Build a Token Bucket Rate Limiter in Go

A token bucket rate limiter can actually increase throughput for bursty traffic by allowing short spikes that exceed the average rate.

2 min read

When to Use and Avoid Reflection in Go

Reflection is a powerful tool in Go, but using it incorrectly can lead to performance issues and code that's difficult to understand.

3 min read

Harden Go Applications: Security Checklist

Go applications are surprisingly easy to secure, but most developers miss the forest for the trees by focusing on individual vulnerabilities instead of .

5 min read

Integrate Go Services with Envoy and Service Mesh Sidecars

Integrate Go Services with Envoy and Service Mesh Sidecars — practical guide covering golang setup, configuration, and troubleshooting with real-world e...

3 min read

How Go Slices Grow: Length, Capacity, and Underlying Arrays

A Go slice's capacity isn't just a suggestion; it's a hard limit on how many elements you can add to the slice before Go has to make a whole new, bigger.

3 min read

Go String vs []byte Performance: When Each One Wins

Go String vs []byte Performance: When Each One Wins — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

3 min read

Add Structured Logging to Go Apps with slog

Add Structured Logging to Go Apps with slog — Go's log/slog package, introduced in Go 1.21, fundamentally shifts how we think about logging by tre.

2 min read

Use Go sync.Mutex, RWMutex, and WaitGroup Correctly

Use Go sync.Mutex, RWMutex, and WaitGroup Correctly — Go's sync.Mutex and sync.RWMutex aren't just about preventing race conditions; they're about control.

3 min read

Write Table-Driven Tests and Benchmarks in Go

Go's testing package is famously simple, but its table-driven test and benchmark pattern is a masterclass in expressive power.

3 min read

Configure TLS and Mutual Auth in Go HTTP Servers

The most surprising thing about TLS and mutual authentication in Go is that you're often better off not using the standard http.

3 min read

Go vs Rust: Choose the Right Language for Your Project

Go and Rust are both modern, performant languages designed for systems programming, but they approach similar problems with vastly different philosophie.

3 min read

Write Zero-Allocation Go Code for Performance-Critical Paths

Go's garbage collector is often cited as a performance bottleneck, but a surprising amount of high-performance Go code is effectively zero-allocation.

3 min read

Fix Go "Imported and Not Used" Compilation Errors

Fix Go "Imported and Not Used" Compilation Errors — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

3 min read

Fix Go "Label Defined and Not Used" Compilation Errors

The Go compiler flagged a label defined and not used error because you've declared a goto or for/switch label, but your code never actually jumps to it.

4 min read

Fix Go "Module Declares Its Path As" Mismatch Errors

The Go toolchain broke because a module declared its own path in its go. mod file, but the directory structure on disk where that module was found didn'.

4 min read

Fix Go "Multiple Value in Single Value Context" Errors

This error means you tried to assign the result of a function that returns multiple values to a single variable, or use it in a place that only expects .

5 min read

Fix Go "No New Variables on Left Side of :=" Errors

The := operator in Go is failing because you're trying to use it to assign a value to a variable that has already been declared in the same scope.

7 min read

Fix Go "Non-Name on Left Side of :=" Assignment Errors

The := operator in Go is failing because you're trying to use it with something that isn't a new variable declaration on the left-hand side.

5 min read

Fix Go "Not Enough Arguments in Call to" Errors

The Go compiler is throwing a "not enough arguments in call to" error because you're trying to call a function or method without providing all the requi.

3 min read

Fix Go panic: runtime error: index out of range

The Go runtime is panicking because a program is trying to access an element in a slice or array using an index that doesn't exist within its valid boun.

4 min read

Fix Go "Runtime: Goroutine Stack Exceeds 1GB Limit"

The Go runtime panicked because a single goroutine's stack grew too large, exceeding the 1GB limit, which indicates a potential infinite recursion or ex.

4 min read

Fix Go "Struct Field in Non-Struct Type" Errors

Fix Go "Struct Field in Non-Struct Type" Errors — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

6 min read

Fix Go "Too Many Arguments in Call to" Errors

This error means the Go compiler found a function call where the number of arguments provided didn't match the number of parameters the function expects.

4 min read

Fix Go "Type-Checking Loop Involving" Errors

The Go compiler got stuck trying to figure out the types of two or more Go types that were circularly defined, and it couldn't resolve them.

4 min read

Fix Go "Undefined Function in Package" Compilation Errors

The Go compiler is reporting an "undefined function" error because it can't find a specific function within a package you're trying to use.

4 min read

Fix Go "Imported and Not Used" Undefined Symbol Errors

This error means the Go compiler found a symbol like a variable, function, or type that your code declared it wanted to use, but it couldn't find the ac.

3 min read

Fix Go "Undefined Method for Type" Compilation Errors

The Go compiler is throwing an "undefined method" error because a type you're using doesn't actually have the method you're trying to call on it.

5 min read

Fix Go "Undefined Variable" Compilation Errors

The Go compiler is complaining about an "undefined variable" because it can't find a symbol variable, function, type, etc.

3 min read

Fix Go "Use of Internal Package Not Allowed" Import Errors

The Go compiler is refusing to allow your program to import packages marked as internal. This error, "use of internal package not allowed," means you're.

4 min read

Fix Go "Ambiguous Import" Found in Multiple Modules

The Go compiler failed because two different packages, both imported by your code, provided the same identifier a function, type, or variable with the s.

3 min read

Fix Go Build Constraints Excluding All Files

The Go build system is rejecting all files in your package because a //go:build directive is too restrictive, effectively telling the compiler to ignore.

4 min read

Fix Go "Declared and Not Used" Variable Errors

The Go compiler is flagging variables that have been declared but never read, indicating a potential logic error or leftover debugging code.

3 min read

Fix Go "No Go Files" Build Errors in Empty Packages

The Go build system is failing to find any source files when it encounters a package that should contain Go code, but appears empty.

4 min read

Fix Go "go.sum Mismatch" Hash Verification Errors

Fix Go "go.sum Mismatch" Hash Verification Errors — The go.sum file is failing verification because a dependency's cryptographic hash doesn't match what.

4 min read

Fix Go Test Flag Ordering Errors

The Go testing framework's flag package is failing to parse flags correctly when they are passed in an order that deviates from the expected sequence, l.

4 min read

Use Atomic Operations vs Mutex in Go for Safe Concurrency

Go's sync/atomic package allows for low-level, hardware-supported atomic operations, which are often a more performant alternative to traditional mutexe.

4 min read

Reduce Go Binary Size for Production and Container Images

Go binaries can be surprisingly large, even for simple "hello world" programs, which can bloat your production containers and increase deployment times.

3 min read

Manage Go Modules and Workspaces in Large Codebases

Go modules are how Go manages dependencies, but they can get tricky in large codebases. Here's a look at how they work in practice, using a simple multi.

3 min read

The Real Performance Cost of CGo in Go Applications

CGo doesn't just add a tiny overhead; it fundamentally changes how your Go program interacts with the outside world, and that interaction can become a s.

3 min read

How Go Channels Work Internally and When to Use Each Pattern

Go channels are more than just queues; they're a fundamental mechanism for inter-goroutine communication, enabling safe and concurrent data sharing.

4 min read

Implement a Circuit Breaker in Go for Resilient Services

Implement a Circuit Breaker in Go for Resilient Services — practical guide covering golang setup, configuration, and troubleshooting with real-world exa...

2 min read

Generate Code at Build Time with go:generate and Templates

go:generate is a build-time code generation tool that lets you automate repetitive tasks, but its real power comes from combining it with Go's text/temp.

4 min read

Build a Worker Pool in Go with Goroutines and Channels

Go's concurrency model lets you build a worker pool where independent tasks are processed concurrently, but not too concurrently.

3 min read

Handle Context Cancellation and Deadlines Correctly in Go

Handle Context Cancellation and Deadlines Correctly in Go — A context.Context in Go isn't a magic wand for managing timeouts; it's a responsibility pass...

4 min read

Tune Go database/sql Connection Pools for Production

Go's database/sql package, often assumed to be a simple wrapper, is actually a sophisticated connection manager that can make or break your application'.

3 min read

Dependency Injection in Go: Wire vs Manual Construction

Wire is a compile-time dependency injection framework for Go that generates dependency injection code, making manual DI feel like a relic of the past.

3 min read

Embed Static Files into Go Binaries with //go:embed

Embed Static Files into Go Binaries with //go:embed — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

3 min read

How Go Escape Analysis Decides Between Stack and Heap Allocation

Go's escape analysis is surprisingly aggressive about putting things on the stack, even when you might expect them to live on the heap.

3 min read

Configure Go Structs Flexibly with the Functional Options Pattern

The functional options pattern lets you configure Go structs with a variable number of optional parameters, bypassing the common pitfalls of constructor.

3 min read

Find Bugs Automatically with Go Fuzz Testing

Go's fuzzing isn't just about finding crashes; it's a powerful tool for discovering unexpected behavior and logic errors in your code.

3 min read

How the Go Garbage Collector Works: Tricolor Marking Explained

The Go garbage collector isn't a background process that periodically pauses your application; it's an integral part of every goroutine, constantly work.

3 min read

Use Go Generics in Production: Patterns and Pitfalls

Go generics are more powerful than you might think, enabling truly reusable code without sacrificing performance or type safety.

5 min read

How the Go Runtime Goroutine Scheduler Works

The Go runtime doesn't actually run your goroutines directly; it multiplexes them onto a smaller, fixed number of OS threads.

3 min read

Shut Down Go Services Gracefully Without Dropping Requests

Shut Down Go Services Gracefully Without Dropping Requests — practical guide covering golang setup, configuration, and troubleshooting with real-world e...

4 min read

Build Production gRPC Services in Go

Build Production gRPC Services in Go — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

2 min read

How the Go net/http Server Handles Requests Internally

How the Go net/http Server Handles Requests Internally — practical guide covering golang setup, configuration, and troubleshooting with real-world examp...

3 min read

Use HTTP/2 Server Push and Streaming in Go

Use HTTP/2 Server Push and Streaming in Go — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

3 min read

How Go Interfaces Work Internally with itab

How Go Interfaces Work Internally with itab. Go interfaces are a bit of a magic trick, and the itab is where the spell is cast. Let's see it in action

2 min read

Senior Go Engineer Interview Questions and Answers

Senior Go Engineer Interview Questions and Answers — practical guide covering golang setup, configuration, and troubleshooting with real-world examples.

3 min read

Write Kubernetes Controllers in Go with controller-runtime

The most surprising thing about Kubernetes controllers is that they don't "control" anything directly; they just observe the desired state and reconcile.

4 min read

How Go Maps Work and Why They're Not Safe for Concurrent Use

Go maps are a fundamental data structure, but their seemingly simple interface hides a complex, dynamic implementation that relies on a hash table.

4 min read

Find and Fix Memory Leaks in Go Applications

A Go application is leaking memory because the garbage collector can't reclaim objects that are still referenced, even though they are no longer logical.

6 min read

The Go Memory Model Explained: Happens-Before and Sync Primitives

The Go memory model is surprisingly simpler than you might think, and it's not about when memory is written, but about what order operations are guarant.

4 min read

Build Go Microservices with Service Discovery and gRPC

The most surprising thing about building Go microservices with gRPC and service discovery is how much of the "magic" is just well-defined interfaces and.

3 min read

Write HTTP Middleware in Go with net/http and Chi

HTTP middleware in Go, when done right, isn't just about adding checks; it's about composing independent, single-purpose functions that build up your re.

2 min read

Structure a Go Monorepo for Multiple Services

A Go monorepo for multiple services isn't just about putting code in one place; it's a deliberate architectural choice that fundamentally changes how yo.

2 min read

Why Go time.Now() Uses a Monotonic Clock

Why Go time.Now() Uses a Monotonic Clock — The surprising truth is that time.Now in Go doesn't always give you the wall-clock time. Let's see t.

2 min read

Instrument Go Services with OpenTelemetry for Distributed Tracing

OpenTelemetry is not just about tracing; it's the future of observability, aiming to standardize how we collect telemetry data across all your services,.

4 min read

Build a Plugin System in Go with Interfaces or Go Plugins

Go's plugin system is surprisingly flexible, letting you load code after your main application has already started, without recompiling anything.

4 min read
ADHDecode

Complex topics, finally made simple

Courses

  • Networking
  • Databases
  • Linux
  • Distributed Systems
  • Containers & Kubernetes
  • System Design
  • All Courses →

Resources

  • Cheatsheets
  • Debugging
  • Articles
  • About
  • Privacy
  • Sitemap

Connect

  • Twitter (opens in new tab)
  • GitHub (opens in new tab)

Built for curious minds. Free forever.

© 2026 ADHDecode. All content is free.

  • Home
  • Learn
  • Courses
Esc
Start typing to search all courses...
See all results →
↑↓ navigate Enter open Esc close