ข้ามไปยังเนื้อหา

Go Deep Dive

คอร์สนี้สอน Go ในเชิงลึก — บนพื้นฐานของภาษา Go เอง ไม่ใช่การเปรียบเทียบกับภาษาอื่น คุณจะเรียนรู้โมเดล concurrency แบบ CSP, type system ที่เข้มแข็ง, และ toolchain ที่ครบครัน ซึ่งทำให้ Go เป็นภาษาที่เลือกใช้สำหรับระบบ production ที่ต้องการประสิทธิภาพสูง

เรียนเป็นลำดับตามโมดูล แต่ละบทเรียนมี snippet ที่รันได้ — ปุ่ม Run จะ compile บน go.dev ด้วย Go รุ่นปัจจุบัน (1.27) และ fallback ไปใช้ interpreter ใน browser (Go 1.26 รองรับเฉพาะ API รุ่นเก่า) เมื่อออฟไลน์ — quiz ตรวจสอบความเข้าใจ, และปุ่มทำเครื่องหมายเสร็จสิ้น เริ่มจาก Basics & Syntax แล้วไล่ขึ้นไปจนถึง Concurrency และ Testing & Tooling

โมดูลหัวข้อสถานะ
Basics & SyntaxVariables, types, control flow, functions, packagesพร้อมใช้งานแล้ว
Types & DataArrays, slices, maps, structs, pointersพร้อมใช้งานแล้ว
Methods & InterfacesMethods บน types, interface design, composition, embeddingพร้อมใช้งานแล้ว
ConcurrencyGoroutines, channels, select, sync, context, patternsพร้อมใช้งานแล้ว
Errors & GenericsError wrapping, custom errors, generics กับ type parameters และ generic method, iterator แบบ range-over-funcพร้อมใช้งานแล้ว
Standard Libraryfmt, strings, io, net/http, encoding/json, timeพร้อมใช้งานแล้ว
Testing & Toolinggo test, table-driven tests, benchmarks, race detector, go vetพร้อมใช้งานแล้ว
Runtime Internalsmemory model, กลไกภายในของ scheduler แบบ GMP, garbage collector กับ escape analysis, และ memory layout จริงของ type ต่าง ๆ ใน Goพร้อมใช้งานแล้ว
Reading & Reviewing Goแคตตาล็อก bug 24 pattern ที่โค้ด Go จาก AI สร้างขึ้นซ้ำๆ, review checklist 1 หน้า, สิ่งที่ go vet/staticcheck/golangci-lint/-race แต่ละตัวจับได้จริง, และโปรแกรมเต็ม 4 ตัวให้ลอง review เองพร้อมใช้งานแล้ว

เริ่มต้นกับ Basics & Syntax หากคุณใหม่กับ Go หรือข้ามไปที่ Concurrency — โมดูลที่ทำให้ Go โดดเด่น หรือถ้ารู้ Go อยู่แล้วแค่อยากฝึกทักษะ review ให้ไปที่ Reading & Reviewing Go ตรงๆ

สิ่งที่ได้ประโยชน์ต้นทุน
goroutinelightweight concurrency (เริ่มที่ ~2 KB stack, โตอัตโนมัติ)scheduler overhead
GCไม่ต้อง manage memory เองGC pause latency
static binarydeploy ง่าย ไม่มี dependencybinary size ใหญ่กว่า interpreted lang
interfaceimplicit satisfaction, decoupled designdynamic dispatch cost

💡 ตัวอย่างจากของจริง

Kubernetes เขียนด้วย Go ทั้งหมด — goroutine หลักแสนตัวจัดการ pod lifecycle พร้อมกัน

Docker ใช้ Go สำหรับ container runtime — memory-efficient และ deploy เป็น single binary

Prometheus ใช้ Go สำหรับ time-series collection — goroutine pool รับ metrics จาก target นับพัน

etcd ใช้ Go สำหรับ distributed key-value store — channel และ mutex ทำให้ consensus algorithm ปลอดภัย