So I have been writing Go services for like two years now, both professionally and as personal projects. Using a certain language in numerous projects over an extended period of time allows you to make mistakes, fix them, realize it's still not the b...
sayedalesawy.hashnode.dev12 min read
Great Article! Very informative.
Just a quick note, you can’t actually intercept SIGKILL (or SIGSTOP for that matter), I believe you meant SIGTERM or SIGINT in your example in (4).
Thanks for sharing, we'll especially want people to ensure they understand CSP (tony Hoare) , and know about the go proverbs ( a source of the sharing memory quote: go-proverbs.github.io )
Good video on the topic: youtube.com/watch
A lot of go problems seem to stem from not understanding how to model their program concurrently
Is it just me or does sync.Once compound the problem? While &sql.Open(...) is running, all other DBConnection will return nil?
The approach with channels from (1) looks dubious to me. You have omitted the important part explaining it by clarity, but what is missing is important for understanding of the concept. Maybe it's just me.
You have to call server.Run() in a goroutine in (4), otherwise your code will block at this method.
Singletons are horrible advice, don't follow that pattern. Anything that creates a static, package level variable is bad.
As far as I know, in most cases singletons are considered an anti-pattern. It's probably better to explicitly pass *sql.DB object around
Great article! I've been used c/c++/c#/java/python for many years, and using go since 2013. All the mentioned lessons I have met before. Thanks for sharing!
Very cool read! I have heard great things about Go. This is a cool overview of some of its functionality. It seems to handle concurrency very well!
Thank you!
Now, Your article made me start learning GO. But I have no experience with strictly typed languages.
I really enjoyed reading your article Sayed Alesawy. Go is not a language I am familiar with but it seems really interesting. Thanks for sharing!
مصطفى الصعيدي
جميلة