#StaticDI

2025-12-24

Bài viết cho rằng trong các API web Go, DI động (fx, dig…) thường thừa thãi. Hầu hết API có đồ thị phụ thuộc tĩnh, chỉ cần khởi tạo một lần. Công cụ compile‑time như wire đáp ứng đủ, nhưng gây phức tạp. Giải pháp nhẹ hơn: generator dựa trên tag trường (injector) tạo mã Go thuần, không container, không reflection. Kết luận: DI tĩnh đủ, giữ wiring đơn giản. #Go #DependencyInjection #WebAPI #LậpTrình #CôngCụ #StaticDI #Injector

dev.to/mickamy/dependency-inje

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst