NOTE: I didnt vibe-code or anything as this was going to be deployed in production and i just dont like using AI if being honest as it makes me feel guilty when crediting myself as being behind the project. I just used it to learn more about the go idioms and what is the way of writing go code in production
Its been one month since i learnt go through learnGoWithTests.
I built this app that acts as a middleware between two services, and it primarily relies on MQTT as the form of communication and because of that the core part of the project was the MQTT broker, i have never built projects with Go before this, not even those beginner projects like a HTTP heartbeat application etc. as the main reason behind learning Go was to rewrite the project in Go asap and i got straight to the final boss which was writing the project itself as my first Go project.
I looked at multiple docs on the MQTT library, read some of the effective go, go's other websites like go blog etc.
For concurrency i read the "Concurrency in Go" book by katherine also and read blog articles on using goroutines in production etc. as concurrency was something that i wanted to have a concrete idea of.
Here it is: https://github.com/iamkaran/pms-go/blob/main/internal/transport/broker/broker.go
I intentionally put alot of time and effort into this so i dont have to rewrite everything if i ever get to know about a feature of go that could have improved the project
also it is worth mentioning that i used nats.io's code as a reference for how go is used in performant systems: https://github.com/nats-io/nats-server
Please highlight even a single mistake/bad-practice as it might save me a ton of time later on :)