logoalt Hacker News

ted_dunningtoday at 2:58 AM1 replyview on HN

The guardrails are channels.

If you have a mutex on a structure, linters such as are packaged into Goland will catch oversights quite effectively.

If you are using fancier concurrency structures, you should consider channels instead.


Replies

netheril96today at 3:29 AM

Channels are not for everything. Plenty of mutex cases cannot be rewritten as channels, or will be very unwieldy so. In fact, every large Go project I have seen uses mutex here or there.

show 1 reply