๐Ÿน

Go in Action

Language core + runtime internals + engineering practice + AI applications in one book. Dives into GMP scheduler, GC, and channel source code. Uses real yiteai-dev-server code โ€” one project per chapter. Covers AI Agents, MCP Servers, and RAG pipelines in Go. 53 chapters.

53
Chapters
Free
Forever
Start Reading →
Table of Contents
Ch01
Go's Design Philosophy: Less Is More
Origin story, positioning vs C++/Java/Rust
Ch02
Development Environment and Toolchain
go build/test/vet/fmt/mod, project structure conventions
Ch03
Basic Types and Control Flow
Integers, floats, strings, booleans, zero-value design
Ch04
Functions, Closures and Defer
Multiple returns, closure pitfalls, defer ordering
Ch05
Composite Types: Arrays, Slices and Maps
Append growth behavior, nil slice vs empty slice
Ch06
Structs, Methods and Interfaces
Value vs pointer receivers, implicit interface implementation
Ch07
Error Handling: error, panic and recover
Error wrapping, errors.Is/As, sentinel errors
Ch08
Generics: From interface{} to Type Parameters
Type parameters, constraints, when to use generics
Ch09
Goroutines: Lightweight Concurrency
Creating and scheduling goroutines, leak detection
Ch10
Channels: Communication Between Goroutines
Buffered/unbuffered, select, fan-in/fan-out/pipeline patterns
Ch11
sync Package: Mutex, WaitGroup, Once, Pool
Mutexes, object pooling, sync.Map use cases
Ch12
Context: Cancellation, Timeout and Value Propagation
WithCancel/WithTimeout/WithValue best practices
Ch13
The Go Compiler: From Source to Binary
AST to SSA to machine code, escape analysis, inlining
Ch14
The GMP Scheduler: How Goroutines Run
G/M/P model, work stealing, preemptive scheduling
Ch15
Memory Allocator: tcmalloc Ideas in Go
mspan/mcache/mcentral/mheap, heap escape conditions
Ch16
Garbage Collection: Tri-Color Marking and Write Barriers
Tri-color invariant, GOGC tuning, soft memory limits
Ch17
Channel Internals: Send, Receive and Select
hchan struct, ring buffer, sudog wait queues
Ch18
Map Internals: Hash Table, Growth and Concurrency
hmap/bmap, incremental growth, sync.Map implementation
Ch19
Slice Internals: Growth Strategy and Memory Traps
SliceHeader, append growth formula, shared backing array traps
Ch20
Interface Internals: iface, eface and Type Assertion
Interface two-word value, itab cache, type assertion performance
Ch21
Reflect and Unsafe: Power and Risk
reflect.Type/Value, unsafe.Pointer rules
Ch22
CGo: The Cost of Dancing with C
CGo call overhead, memory management boundaries
Ch23
Network Model: netpoll and the epoll Wrapper
Go network I/O model, comparison with Nginx and Node.js
Ch24
Performance Analysis: pprof, trace and Benchmark
CPU/memory profiling, go tool trace, optimization patterns
Ch25
Project Architecture and Dependency Injection
Config to Server to Handler startup chain
Ch26
Web Services and Router Design
Gin framework, route groups, RESTful design
Ch27
Middleware Patterns
Rate limiting, logging, CORS, security header middleware
Ch28
Template Rendering and SEO
html/template engine, sitemap generation, JSON-LD
Ch29
Web Scraping: Concurrency and Rate Limiting
Worker pools, token bucket rate limiting, error retry
Ch30
Building CLI Tools
flag/cobra, progress reporting, subcommand design
Ch31
IP Lookup Service: Binary Protocol Parsing
IP2Location BIN parsing, CGo integration
Ch32
DNS Server: UDP Network Programming
DNS protocol, goroutine-per-request model
Ch33
WebSocket Real-Time Communication
Long connection management, heartbeat, broadcast patterns
Ch34
TLS Fingerprint Detection
Custom crypto/tls, JA3/JA4 fingerprinting
Ch35
Background Jobs and Graceful Shutdown
Timers, signal handling, graceful shutdown
Ch36
Build an HTTP Server from Scratch
net/http internals, TCP management, keep-alive
Ch37
Build a TCP Proxy
Bidirectional io.Copy, connection pooling, timeouts
Ch38
Build a Redis Client
RESP protocol parsing, connection pooling, pipelining
Ch39
Build a Message Queue
Persistence, pub/sub, consumer groups
Ch40
Build a Simple Container
Namespaces, cgroups, process isolation
Ch41
Build a Simple Database
B+Tree storage engine, WAL, MVCC basics
Ch42
Build an RPC Framework
Protobuf serialization, service registry, load balancing
Ch43
Build a Simple Shell
os/exec, pipes, signal handling
Ch44
Code Generation and Static Analysis
go/ast, go generate, custom linters
Ch45
Observability: Logging, Metrics and Tracing
zap logging, Prometheus metrics, OpenTelemetry
Ch46
Database Access: SQL, ORM and Connection Pool
database/sql, sqlx vs GORM, N+1 problem
Ch47
Authentication and Security
JWT, OAuth2, bcrypt, CSRF protection
Ch48
Build and Deploy
Multi-stage Docker, cross-compilation, systemd, CI/CD
Ch49
Calling LLM APIs: Streaming and Error Handling
Claude/OpenAI SDK, SSE streaming, token management
Ch50
Building AI Agents: Tool Use and Multi-Turn Dialogue
Function calling, tool dispatch, agent main loop
Ch51
Building an MCP Server
MCP protocol, JSON-RPC over stdio, Go implementation
Ch52
RAG Pipeline: Retrieval-Augmented Generation
Text chunking, embedding API, vector storage
Ch53
Vector Search Engine: Implementing HNSW from Scratch
HNSW algorithm in Go, approximate nearest neighbors

๐Ÿ’ฌ Comments