Hacker News new | ask | show | jobs
by cgag 4363 days ago
What does Go do that makes writing network protocols simple?
2 comments

All of the HTTP, socket, encryption, compression etc libraries have a really clean, consistent design based around stackable reader and writer interfaces. This makes it really easy to combine things, swap out transport layers etc.

Go routines and channels are also nice for handling concurrent requests though I find myself using mutexes more than channels for finer grained control.

Go makes it straightforward to have one program efficiently communicating with many different servers and clients. It does this by having all network IO be event-based in such a way that it's effectively tied directly into the scheduler, and then communicating between the different goroutines managing all these connections is very easy.