GO (GOLANG) EĞİTİMİ
Go eğitimi, dilin sade söz dizimini production ölçeğine taşıyan bir programdır. Goroutine ve channel ile concurrent program tasarımı, sync.Mutex ile channel arasında doğru senaryo seçimi günlük senaryolar üzerinden işlenir. context.Context ile cancellation ve timeout'ın zincire propagate edilmesi temel pratiktir.
Eğitim sonunda katılımcı, error handling'i panic yerine wrap/unwrap pattern ile yönetir; interface'i implicit implementation ile pragmatik kullanır. Go modules ile dependency yönetimi go.sum üzerinden bilinçli yapılır; pprof ve trace ile production-grade profiling eğitimin operasyonel kapanışıdır. Eğitim sırasında Go belgeleri temel referans olarak kullanılır.
Katılımcı Profili
Bu eğitim, Go'nun sade ekosistemini ölçekli sistemlere taşımak isteyen rollere yöneliktir:
- Backend Mühendisleri: Yüksek concurrency'li servis yazan ekipler
- DevOps Mühendisleri: CLI ve internal tooling yazan roller
- Cloud Native Geliştiriciler: Kubernetes operator ve controller geliştiren mühendisler
- Microservice Geliştiriciler: gRPC tabanlı dağıtık sistem kuran ekipler
- Performans Mühendisleri: Düşük latency hedefiyle Go tercih eden roller
Ön Gereklilikler
Bu eğitime katılım için aşağıdaki ön bilgiler önerilir:
- Herhangi bir dilde temel programlama (variable, loop, function) deneyimi
- HTTP, REST API ve JSON kavramlarına aşinalık
- Komut satırı (Bash veya PowerShell) ile rahat çalışma
- Git ile temel sürüm kontrol akışı
- Concurrent programlamaya (thread, async) genel ilgi
Süresi ve Tarihi
Süre: 3 gün. Bu süre standart program içindir; ek modüllere ve hedefe göre süre özelleştirilebilir.
Eğitim tarihleri ve saatleri, ekibinizin uygunluğuna göre birlikte planlanır.
Kazanımlar
Bu eğitim sonunda katılımcı, Go'nun sade söz dizimini production ölçeğine taşıyabilir:
- Goroutine ve channel ile concurrent program tasarlar
- sync.Mutex ile channel arasında doğru senaryo seçimi yapar
- context.Context ile cancellation ve timeout'ı zincire propagate eder
- Error handling'i panic yerine wrap/unwrap pattern ile yönetir
- Interface'i implicit implementation ile pragmatik kullanır
- Go modules ile dependency'i go.sum üzerinden bilinçli yönetir
- pprof ve trace ile production-grade profiling yapar
Go (Golang) Eğitimi Konuları
1. Go Felsefesi ve Simple by Design
- "Less is more" prensibi ve dil sadeliği
- Go'nun Google'daki çıkış nedeni ve hedefleri
- Java/C# ve Go arasındaki tasarım farkları
- Static binary, fast compile, garbage collection
2. Söz Dizimi ve Temel Tipler
- Variable declaration: var, :=, const
- Basic types: int, float64, string, bool, byte, rune
- Zero value ve initialization
- Type conversion ve type assertion
- iota ile enum benzeri sabitler
3. Slice, Map, Struct
- Array vs slice: length ve capacity
- Slice trick'leri: append, copy, sub-slice
- Map operasyonları ve concurrent map riski
- Struct ve embedded struct (composition)
- Struct tag ve reflection
4. Pointer ve Memory Modeli
- Pointer söz dizimi: & ve *
- Value receiver vs pointer receiver
- Escape analysis ve heap allocation
- new ve make farkı
5. Function ve Method
- Multiple return value ve named return
- Variadic function (...)
- Closure ve function literal
- defer, panic, recover
- Method ve receiver tipi seçimi
6. Interface - Implicit Implementation
- Implicit interface implementation
- Empty interface (interface{} ve any)
- Type assertion ve type switch
- Interface segregation: small interface tercihi
- io.Reader, io.Writer örnek tasarım
7. Error Handling ve Error Wrapping
- error interface ve idiomatik kullanım
- errors.Is ve errors.As
- fmt.Errorf ile %w wrapping
- Custom error type tasarımı
- Panic-recover ne zaman uygun
8. Goroutine ve GOMAXPROCS
- Goroutine: lightweight thread
- GOMAXPROCS ve scheduler
- Goroutine leak tespiti
- M:N scheduling modeli
9. Channel ve Select
- Unbuffered ve buffered channel
- Channel direction (send-only, receive-only)
- select statement ve default case
- Channel close ve range
- "Don't communicate by sharing memory; share memory by communicating"
10. Context Package
- context.Background ve context.TODO
- WithCancel, WithTimeout, WithDeadline
- Value propagation ve anti-pattern
- HTTP request context kullanımı
11. Sync Primitives - Mutex, WaitGroup
- sync.Mutex ve sync.RWMutex
- sync.WaitGroup ile goroutine bekleme
- sync.Once ile lazy initialization
- sync.Pool ile object reuse
- atomic package ile lock-free
12. Package, Module, Import
- Package convention ve naming
- go.mod ve go.sum dosyaları
- Semantic Import Versioning
- Vendor mode ve module cache
- Internal package ile görünürlük
13. Generics - Type Parameters
- Type parameter söz dizimi
- Type constraint ve interface
- Built-in: comparable, any, ordered
- Generic function vs concrete: trade-off
14. Standart Kütüphane - net/http, encoding/json
- net/http: Server, Handler, ServeMux
- encoding/json: Marshal, Unmarshal
- io, bufio, os paketleri
- time ve duration kullanımı
- strings, strconv yardımcı paketleri
15. Build, Compile ve Cross-Platform
- go build, go install, go run komutları
- GOOS ve GOARCH ile cross-compile
- Build tag ve conditional compilation
- CGO ve native kütüphane çağırma
- Embed directive (//go:embed)
16. Test - testing Package ve Table-Driven
- go test ve _test.go dosyaları
- Table-driven test idiomatic stili
- testing.T ve subtests (t.Run)
- Mock yerine interface bazlı test
- testify alternatifi ve native yaklaşım
17. Benchmark ve Profiling - pprof
- go test -bench ile benchmark
- net/http/pprof ile live profiling
- CPU profile, heap profile, goroutine profile
- go tool pprof ile analiz
- Trace ve flame graph
18. Reflect ve Type Introspection
- reflect.Type ve reflect.Value
- Struct tag okuma
- Reflection maliyeti
- Generic'in reflection'a alternatifi
19. Web Server - chi, gin, echo
- net/http ile minimal sunucu
- chi: middleware-friendly router
- gin ve echo karşılaştırması
- Middleware pattern Go'da
- Graceful shutdown
20. Deployment - Statik Binary ve Container
- Static binary avantajı (no runtime)
- FROM scratch Dockerfile
- distroless image kullanımı
- Health endpoint ve graceful shutdown
GO (GOLANG) EĞİTİMİ ile İlgili
Sıkça Sorulan Sorular ve Cevapları
Goroutine ve thread arasındaki fark nedir?
OS thread MB seviyesinde stack ve kernel overhead ile gelir; binlerce thread sistemi yorar. Goroutine birkaç KB ile başlar (büyür/küçülür), Go runtime'da scheduler M:N model ile mapping yapar. Yüzbinlerce concurrent goroutine pratik. Tradeoff: goroutine'lar cooperative — uzun CPU iş bloklar.
Channel ile sync.Mutex arasında ne zaman hangisi seçilir?
Channel 'paylaşılan veriyi haberleşerek paylaş' felsefesini taşır — pipeline, fan-in/fan-out, worker pool için doğal. Mutex paylaşılan struct'ta küçük critical section korur; basit cache veya counter için pratik. Go proverb: 'Don't communicate by sharing memory; share memory by communicating' — ama Mutex de yerinde kullanılmalı.
context.Context cancellation zincirini nasıl çalıştırır?
context.WithCancel, WithTimeout veya WithDeadline parent'tan child context üretir. Parent cancel olunca child'ın Done() channel'ı kapanır ve aşağı doğru tüm zincire propagate olur. HTTP handler veya RPC çağrısında parent context'i sürekli geçirmek standart pratik — timeout ve client cancel düzgün yayılır.
Error handling neden if err != nil pattern'i?
Go explicit hata yönetimi tercih eder — exception yok, her fonksiyon hata return edebilir. Bu boilerplate'e yol açar ama hata yolunu kod okurken görünür kılar. errors.Is, errors.As ve fmt.Errorf %w ile wrap/unwrap zinciri yapılır. Yeni Go önerileri syntax kısaltma yönünde değil.
Interface implicit implementation neden avantajdır?
Go'da bir tip interface'i 'implements' demek zorunda değil; gereken metodları taşıyorsa otomatik uyumludur. Bu duck typing tarzı çalışma library tasarımını sadeleştirir — tüketici interface tanımlar, sağlayıcı bilmesi gerekmez. Tradeoff: dökümantasyondan tip uyumunu görmek bazen zor.
pprof ve trace ile production diagnostic nasıl alınır?
net/http/pprof endpoint'i CPU, heap, goroutine, mutex profili sunar — production'da go tool pprof ile analiz edilir. runtime/trace event-based timeline üretir; goroutine scheduling, GC ve syscall delay'i görselleştirir. İkisi birlikte 'neden yavaş' sorusunu hangi katmanda olduğunu söyler.



