Go Deep Dive
ยินดีต้อนรับสู่ Go Deep Dive
หัวข้อที่มีชื่อว่า “ยินดีต้อนรับสู่ Go Deep Dive”คอร์สนี้สอน Go ในเชิงลึก — บนพื้นฐานของภาษา Go เอง ไม่ใช่การเปรียบเทียบกับภาษาอื่น คุณจะเรียนรู้โมเดล concurrency แบบ CSP, type system ที่เข้มแข็ง, และ toolchain ที่ครบครัน ซึ่งทำให้ Go เป็นภาษาที่เลือกใช้สำหรับระบบ production ที่ต้องการประสิทธิภาพสูง
วิธีใช้คอร์สนี้
หัวข้อที่มีชื่อว่า “วิธีใช้คอร์สนี้”เรียนเป็นลำดับตามโมดูล แต่ละบทเรียนมี snippet ที่รันได้ใน browser, quiz ตรวจสอบความเข้าใจ, และปุ่มทำเครื่องหมายเสร็จสิ้น เริ่มจาก Basics & Syntax แล้วไล่ขึ้นไปจนถึง Concurrency และ Testing & Tooling
ภาพรวมโมดูล
หัวข้อที่มีชื่อว่า “ภาพรวมโมดูล”| โมดูล | หัวข้อ | สถานะ |
|---|---|---|
| Basics & Syntax | Variables, types, control flow, functions, packages | พร้อมใช้งานแล้ว |
| Types & Data | Arrays, slices, maps, structs, pointers | พร้อมใช้งานแล้ว |
| Methods & Interfaces | Methods บน types, interface design, composition, embedding | พร้อมใช้งานแล้ว |
| Concurrency | Goroutines, channels, select, sync, context, patterns | พร้อมใช้งานแล้ว |
| Errors & Generics | Error wrapping, custom errors, generics กับ type parameters | พร้อมใช้งานแล้ว |
| Standard Library | fmt, strings, io, net/http, encoding/json, time | พร้อมใช้งานแล้ว |
| Testing & Tooling | go test, table-driven tests, benchmarks, race detector, go vet | พร้อมใช้งานแล้ว |
เริ่มต้นกับ Basics & Syntax หากคุณใหม่กับ Go หรือข้ามไปที่ Concurrency — โมดูลที่ทำให้ Go โดดเด่น
ทำไม Go?
หัวข้อที่มีชื่อว่า “ทำไม Go?”| สิ่งที่ได้ | ประโยชน์ | ต้นทุน |
|---|---|---|
| goroutine | lightweight concurrency (2-8 KB stack) | scheduler overhead |
| GC | ไม่ต้อง manage memory เอง | GC pause latency |
| static binary | deploy ง่าย ไม่มี dependency | binary size ใหญ่กว่า interpreted lang |
| interface | implicit satisfaction, decoupled design | dynamic dispatch cost |
| no generics (pre-1.18) | simplicity | code duplication |
💡 ตัวอย่างจากของจริง
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 ปลอดภัย